In this notebook the code for the publication “Schoen et al. 2023, Christensenella minuta boosts gut microbial biomass and voluntary physical activity in mice” for all analyses is provided.
if (!require("data.table")) install_packages("data.table")
Loading required package: data.table
Registered S3 method overwritten by 'data.table':
method from
print.data.table
data.table 1.14.2 using 40 threads (see ?getDTthreads). Latest news: r-datatable.com
library(data.table)
if (!require("tidyverse")) install_packages("tidyverse")
Loading required package: tidyverse
Registered S3 methods overwritten by 'dbplyr':
method from
print.tbl_lazy
print.tbl_sql
── Attaching packages ────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.1 ──
✓ ggplot2 3.3.5 ✓ purrr 0.3.4
✓ tibble 3.1.6 ✓ dplyr 1.0.8
✓ tidyr 1.2.0 ✓ stringr 1.4.0
✓ readr 2.1.2 ✓ forcats 0.5.1
── Conflicts ───────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
x dplyr::between() masks data.table::between()
x dplyr::filter() masks stats::filter()
x dplyr::first() masks data.table::first()
x dplyr::lag() masks stats::lag()
x dplyr::last() masks data.table::last()
x dplyr::location() masks switchr::location()
x purrr::transpose() masks data.table::transpose()
library(tidyverse)
if (!require("ggplot2")) install_packages("ggplot2")
library(ggplot2)
if (!require("ggthemes")) install_packages("ggthemes")
Loading required package: ggthemes
library(ggthemes)
if (!require("scales")) install_packages("scales")
Loading required package: scales
Attaching package: ‘scales’
The following object is masked from ‘package:purrr’:
discard
The following object is masked from ‘package:readr’:
col_factor
library(scales)
if (!require("ggforce")) install_packages("ggforce")
Loading required package: ggforce
library(ggforce)
if (!require("ggpubr")) install_packages("ggpubr")
Loading required package: ggpubr
library(ggpubr)
if (!require('lubridate')) install_packages('lubridate')
Loading required package: lubridate
Attaching package: ‘lubridate’
The following objects are masked from ‘package:data.table’:
hour, isoweek, mday, minute, month, quarter, second, wday, week, yday, year
The following objects are masked from ‘package:base’:
date, intersect, setdiff, union
library(lubridate)
if (!require('car')) install_packages('car')
Loading required package: car
Loading required package: carData
Attaching package: ‘car’
The following object is masked from ‘package:dplyr’:
recode
The following object is masked from ‘package:purrr’:
some
library(car)
if (!require('Rmisc')) install_packages('Rmisc')
Loading required package: Rmisc
Loading required package: lattice
Loading required package: plyr
-----------------------------------------------------------------------------------------------------------------------------------------
You have loaded plyr after dplyr - this is likely to cause problems.
If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
library(plyr); library(dplyr)
-----------------------------------------------------------------------------------------------------------------------------------------
Attaching package: ‘plyr’
The following object is masked from ‘package:ggpubr’:
mutate
The following objects are masked from ‘package:dplyr’:
arrange, count, desc, failwith, id, mutate, rename, summarise, summarize
The following object is masked from ‘package:purrr’:
compact
library(Rmisc)
if (!require('bestNormalize')) install_packages('bestNormalize')
Loading required package: bestNormalize
library(bestNormalize)
if (!require('PerformanceAnalytics')) install_packages('PerformanceAnalytics')
Loading required package: PerformanceAnalytics
Loading required package: xts
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Attaching package: ‘xts’
The following objects are masked from ‘package:dplyr’:
first, last
The following objects are masked from ‘package:data.table’:
first, last
Attaching package: ‘PerformanceAnalytics’
The following object is masked from ‘package:graphics’:
legend
library(PerformanceAnalytics)
if (!require('lmerTest')) install_packages('lmerTest')
Loading required package: lmerTest
Loading required package: lme4
Loading required package: Matrix
Attaching package: ‘Matrix’
The following objects are masked from ‘package:tidyr’:
expand, pack, unpack
Attaching package: ‘lmerTest’
The following object is masked from ‘package:lme4’:
lmer
The following object is masked from ‘package:stats’:
step
library(lmerTest)
if (!require('reshape2')) install_packages('reshape2')
Loading required package: reshape2
Attaching package: ‘reshape2’
The following object is masked from ‘package:tidyr’:
smiths
The following objects are masked from ‘package:data.table’:
dcast, melt
library(reshape2)
if (!require('emmeans')) install_packages('emmeans')
Loading required package: emmeans
library(emmeans)
if (!require('Maaslin2')) install_packages('Maaslin2')
Loading required package: Maaslin2
library(Maaslin2)
if (!require("effects")) install.packages("effects")
Loading required package: effects
Use the command
lattice::trellis.par.set(effectsTheme())
to customize lattice options for effects plots.
See ?effectsTheme for details.
library(effects)
if (!require("vegan")) install.packages("vegan")
Loading required package: vegan
Loading required package: permute
This is vegan 2.5-7
library(vegan)
if (!require("patchwork")) install.packages("patchwork")
Loading required package: patchwork
library(patchwork)
if (!require("ggmap")) install_packages("ggmap")
Loading required package: ggmap
ℹ Google's Terms of Service: <https://mapsplatform.google.com>
ℹ Please cite ggmap if you use it! Use `citation("ggmap")` for details.
library(ggmap)
if (!require("maps")) install_packages("maps")
Loading required package: maps
Attaching package: ‘maps’
The following object is masked from ‘package:plyr’:
ozone
The following object is masked from ‘package:purrr’:
map
library(maps)
if (!require("mapdata")) install_packages("mapdata")
Loading required package: mapdata
library(mapdata)
if (!require("partR2")) remotes::install_github("mastoffel/partR2")
Loading required package: partR2
library(partR2)
if (!require("rsq")) install_packages("rsq")
Loading required package: rsq
library(rsq)
if (!require("cowplot")) install_packages("cowplot")
Loading required package: cowplot
Attaching package: ‘cowplot’
The following object is masked from ‘package:ggmap’:
theme_nothing
The following object is masked from ‘package:patchwork’:
align_plots
The following object is masked from ‘package:lubridate’:
stamp
The following object is masked from ‘package:ggpubr’:
get_legend
The following object is masked from ‘package:ggthemes’:
theme_map
library(cowplot)
if (!require("ggmap")) install_packages("ggmap")
library(ggmap)
if (!require("maps")) install_packages("maps")
library(maps)
if (!require("mapdata")) install_packages("mapdata")
library(mapdata)
if (!require("patchwork")) install_packages("patchwork")
library(patchwork)
if (!require("ggh4x")) install_packages("ggh4x")
Loading required package: ggh4x
library(ggh4x)
if (!require("ggbeeswarm")) install_packages("ggbeeswarm")
Loading required package: ggbeeswarm
library(ggbeeswarm)
backup_options <- options() #only run when restarting the session to save the default options
options(backup_options)
shape_Sex <- c(16, 4)
color_Category <- c("darkgoldenrod1", "darkblue")
color_HL <- c("sienna1", "deepskyblue")
color_distict <- c("#000000","#004949","#009292","#ff6db6","#ffb6db",
"#490092","#006ddb","#b66dff","#6db6ff","#b6dbff",
"#920000","#924900","#db6d00","#24ff24","#ffff6d")
properColnames=function(x){
gsub(" ", "_",
gsub("-", "_",
gsub(":", "_",
gsub("\\+", "_",
gsub("\\.", "_",
gsub("\\(", "",
gsub("\\)", "",
gsub("^\\d", "", names(x)))))))))
}
properNames = function(x){
gsub(" ", "_",
gsub("-", "_",
gsub(":", "_",
gsub("\\+", "_",
gsub("\\.", "_",
gsub("\\(", "",
gsub("\\)", "",
gsub("^\\d", "", x))))))))
}
setwd(dir = "XXXX")
# Christensenellacae global human studies
Figure_globe_data <- fread("./data/FigureS1/map_data.txt") %>% dplyr::arrange(-Sample_size_of_cohort)
# metadata including murine data, body composition measurements, weekly weight measurement, spilled food and feces in respirometry cages, bomb calorimetry mesurements, and qPCR mesurements
metadata <- fread("./data/Metadata/Mouse_metadata.txt")
Metadata_exclude_id <- c(6296,6305,6374,6372, #sick
6350,6426,6451, 6455) #died
metadata <- metadata %>% dplyr::filter(!str_detect(MouseID, paste(Metadata_exclude_id, collapse="|")))
#Promethion
Promethion <- fread("./data/Promethion/Promethion_data_raw.txt")
Circadian <- fread("./data/Promethion/Promethion_data_circadian.txt")
# Metabolomics
## LCMS
### untargeted
LCMS_xcms_output <- fread("./data/Metabolomics/LCMS_serum_untargeted_XCMS.diffreport.MultiClass.tsv")
### targeted
LCMS_serum <- fread("./data/Metabolomics/LCMS_trargeted_serum_area.csv")
## GC-MS: SCFA
GCMS_SCFAs <- fread("./data/Metabolomics/GCMS_SCFAs.txt")
# Metagenomics
## qPCR
qPCR_data <- fread("./data/Metagenomics/qPCR_data.txt")
## Shotgun Sequencing
Metagenomics_metadata_CC <- fread("./data/Metagenomics/Metagenomics_metadata_CC.txt")
Metagenomics_exclude_id <- c("6296", "6305", "6350", "6374", "6372", "6426", "6451", "6455" # sick anmals
, "6434", "6420") #low DNA extraction yield --> low qPCR signal --> normalization not possible
Bracken_otu_table_relFreq <- fread("./data/Metagenomics/Bracken_otu_table_relFreq.txt") # with Donor
Bracken_otu_table_reads <- fread("./data/Metagenomics/Bracken_otu_table_reads.txt") # without Donor
start_date <- as.Date("2020-05-01") #defining common starting date for all recordings
Promethion.2 <- Promethion %>%
dplyr::filter(!str_detect(MouseID, paste(Metadata_exclude_id, collapse="|"))) %>%
dplyr::mutate(Date = as.POSIXct(trunc(as.POSIXct(DateTime), units = "hours"))) %>%
dplyr::group_by(MouseID) %>%
dplyr::mutate(difference_start_date = round(as.numeric(difftime(as.Date(min(DateTime), format = "%Y%m%d"), start_date, units = "day"))),
Date_common = Date - lubridate::days(difference_start_date)) %>% # create a date-column with a common starting date
dplyr::ungroup() %>%
dplyr::left_join(metadata, by = c("MouseID", "Batch", "Promethion_Position"))
Circadian.2 <- Circadian %>%
dplyr::filter(!str_detect(MouseID, paste(Metadata_exclude_id, collapse="|"))) %>%
dplyr::mutate(StartDate = as.POSIXct(StartDate)) %>%
dplyr::group_by(MouseID) %>%
dplyr::mutate(difference_start_date = round(as.numeric(difftime(as.Date(min(StartDate), format = "%Y%m%d"), start_date, units = "day"))),
StartDate_common = StartDate - lubridate::days(difference_start_date)) %>% # create a date-column with a common starting date
dplyr::ungroup() %>%
dplyr::filter(StartDate_common != "2020-05-04",
StartDate_common != "2020-05-01") # exclude acclimatization and take down
Sorted by paragraphs of results ## Figure S1 - Global map of studies associating the gut bacterial family Christensenellaceae with healthy body mass index and/or metabolic health in human gut microbiome studies.
FigureS1 <- ggplot() +
geom_polygon(data = map_data('world'),
aes(x=long, y = lat, group = group),
fill='gray20', color='white', size=0.1) +
geom_point(data=Figure_globe_data, aes(x=Long, y=Lat, size=Sample_size_of_cohort, fill = Association),
alpha=0.6, shape =21, color = "white") +
scale_fill_manual(values = c("#CC79A7", "#009E73")) +
coord_cartesian(xlim = c(-160, 180),
ylim = c(-50, 80)) +
scale_size_continuous('Sample\nsize',
range=c(1,12),
breaks=c(100, 500, 2000, 5000)) +
labs(x='Longitude', y='Latitude') +
theme_classic(base_size = 10) +
theme(
panel.grid = element_blank(),
panel.background = element_rect(fill=alpha('lightsteelblue', 1))
) +
guides(fill = guide_legend(override.aes = list(size = 4, alpha = 1)), size = guide_legend(override.aes = list(shape = 21, color = "black")))
FigureS1
ggsave("./FigureS1.pdf", plot = FigureS1, device = cairo_pdf,
width = 16.5,
height = 7.5,
units = "cm")
metadata_Cmin <- metadata %>%
dplyr::filter(MouseID != 6434, MouseID != "6420", # too low DNA yield during DNA extraction --> technical issue
MouseID != 6477) %>%
dplyr::left_join(qPCR_data, by ="MouseID")# extreme outlier according to residuals -> excluded for normality reasons
Fig1_qPCR_Cmin<-metadata_Cmin %>%
dplyr::mutate(Cmin_per_gCC_1e7 = qPCR_Cmin_per_gCC / 10000000) %>%
ggplot(aes(x = Category, y = Cmin_per_gCC_1e7, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = expression(paste("C. minuta (GE/g) x",e^7))) +
theme(axis.text.x = element_text(face = "italic"))
Fig1_qPCR_Cmin
set.seed(569)
metadata_Cmin$qPCR_Cmin_per_gCC_norm <- predict(bestNormalize(metadata_Cmin$qPCR_Cmin_per_gCC))
options(contrasts=c("contr.sum", "contr.poly"))
model_Cmin<-lmer(qPCR_Cmin_per_gCC_norm ~ Category + qPCR_Round + (Category | Batch), data = metadata_Cmin)
lmerTest::step(model_Cmin)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 7 -173.33 360.67
Category in (Category | Batch) 0 5 -191.78 393.56 36.888 2 9.771e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category 0 9.3749 9.3749 1 11.008 28.863 0.0002254 ***
qPCR_Round 0 9.8730 9.8730 1 11.160 30.396 0.0001733 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
qPCR_Cmin_per_gCC_norm ~ Category + qPCR_Round + (Category | Batch)
Testing model assumptions (normality and heteroscedasticity of residuals)
options(contrasts=c("contr.sum", "contr.poly"))
model_Cmin.2<-lmer(qPCR_Cmin_per_gCC_norm ~ Category + qPCR_Round + (Category | Batch), data = metadata_Cmin)
shapiro.test(residuals(model_Cmin.2)) # test normality of residuals
Shapiro-Wilk normality test
data: residuals(model_Cmin.2)
W = 0.98985, p-value = 0.2265
anova(lm(residuals(model_Cmin.2) ~ fitted(model_Cmin.2))) # test for heteroscedasticity
Analysis of Variance Table
Response: residuals(model_Cmin.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted(model_Cmin.2) 1 0.133 0.13338 0.4445 0.5058
Residuals 179 53.716 0.30009
plot(model_Cmin.2)
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_Cmin.2, type = "II", test.statistic ="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: qPCR_Cmin_per_gCC_norm
F Df Df.res Pr(>F)
Category 28.857 1 10.999 0.0002262 ***
qPCR_Round 25.133 1 10.861 0.0004098 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Calculation of means and SD with raw values
model_Cmin.eff<-lmer(qPCR_Cmin_per_gCC ~ Category + qPCR_Round + (Category | Batch), data = metadata_Cmin)
Warning: Model may not have converged with 1 eigenvalue close to zero: 1.5e-11
effects::effect("Category", model_Cmin.eff, se =TRUE) %>% as.data.frame()
examination of C. minuta in Donor sample
Bracken_otu_table_relFreq %>%
dplyr::select(-contains(Metagenomics_exclude_id), -taxonomy) %>%
dplyr::filter(OTU_ID == "s__Christensenella minuta") %>%
dplyr::rename(rowname = OTU_ID) %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value) %>%
dplyr::rename(sampleid = var, s__Cmin_rel = "s__Christensenella minuta") %>%
dplyr::left_join(Metagenomics_metadata_CC, by ="sampleid") %>%
dplyr::left_join(metadata, by ="MouseID") %>%
dplyr::mutate(Category = ifelse(grepl("Donor", sampleid), "Donor", Category)) %>%
ggplot(aes(x = Category, y = s__Cmin_rel, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = c("black", color_Category), label = c("Donor","Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "relative C.minuta") +
theme(axis.text.x = element_text(face = "italic"))
metadata_weight <- metadata %>%
dplyr::mutate(Category_Sex = paste(Category, Sex, sep="_")) %>%
dplyr::select(MouseID, Batch, Sex, Category, Category_Sex, Litter, T0_weight, T1_weight, T2_weight, T3_weight, Promethion_weight) %>%
dplyr::rename("7" = "T1_weight", "14" = "T2_weight", "21" = "T3_weight", "28" = "Promethion_weight") %>%
tidyr::gather(Day, weight, "7":"28")
metadata_weight_withT0<- metadata %>%
dplyr::mutate(Category_Sex = paste(Category, Sex, sep="_")) %>%
dplyr::select(MouseID, Batch, Sex, Category, Category_Sex, Litter, T0_weight, T1_weight, T2_weight, T3_weight, Promethion_weight) %>%
dplyr::rename("0" = "T0_weight", "7" = "T1_weight", "14" = "T2_weight", "21" = "T3_weight", "28" = "Promethion_weight") %>%
tidyr::gather(Day, weight, "0":"28") %>%
dplyr::mutate(Day = as.numeric(Day))
metadata_weight_withT0.2 <- na.omit(metadata_weight_withT0)
metadata_weight_withT0_summary <- Rmisc::summarySE(metadata_weight_withT0.2, measurevar = "weight",
groupvar = c("Category", "Day", "Sex", "Category_Sex"), conf.interval = 0.95)
FigS2_weight <- ggplot(metadata_weight_withT0_summary, aes(x=Day, y=weight, group=Category_Sex, color=Category)) +
geom_line(alpha = 0.7) +
geom_errorbar(aes(ymin=weight-ci, ymax=weight+ci),
position=position_dodge(0.05), alpha = 0.7, linetype = "dashed") +
geom_point(aes(shape = Sex), size = 3, alpha =1) +
scale_shape_manual(values=shape_Sex) +
labs(y = "Weight (g)", x = "Days") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
scale_x_continuous(breaks = c(0, 7, 14, 21, 25, 28)) +
theme_classic(base_size = 10)
FigS2_weight
statistical analysis
set.seed(673)
metadata_weight$weight_norm<- predict(bestNormalize(metadata_weight$weight))
metadata_weight$T0_weight_norm<- predict(bestNormalize(metadata_weight$T0_weight))
metadata_weight$Day_factor <- as.factor(metadata_weight$Day)
metadata_weight$MouseID_factor <- as.factor(metadata_weight$MouseID)
options(contrasts=c("contr.sum", "contr.poly"))
model_weight<- lmerTest::lmer(weight_norm ~ Category*Sex*Day_factor + T0_weight_norm + (1|Batch/Sex) + (1|MouseID_factor/Batch/Sex), data = metadata_weight)
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 3 negative eigenvaluesWarning: Model failed to converge with 2 negative eigenvalues: -4.9e-04 -4.9e-04
lmerTest::step(model_weight, keep = "Category")
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?Warning: Model failed to converge with 1 negative eigenvalue: -2.3e-05Warning: Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?Warning: Model failed to converge with 1 negative eigenvalue: -2.3e-05Warning: Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?Warning: Model failed to converge with 1 negative eigenvalue: -2.3e-05Warning: Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?Warning: Model failed to converge with 1 negative eigenvalue: -2.3e-05Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -8.0e-05Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -8.0e-05Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -8.0e-05Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -2.7e-05
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 23 -41.739 129.48
(1 | Sex:(Batch:MouseID_factor)) 1 22 -41.739 127.48 0.00 1 1
(1 | Sex:Batch) 2 21 -41.739 125.48 0.00 1 1
(1 | MouseID_factor) 3 20 -41.739 123.48 0.00 1 1
(1 | Batch) 0 19 -69.436 176.87 55.39 1 9.86e-14 ***
(1 | Batch:MouseID_factor) 0 19 -256.417 550.83 429.36 1 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category:Sex:Day_factor 1 0.1798 0.0599 3 534.43 1.9408 0.1220
Category:Day_factor 2 0.0189 0.0063 3 537.44 0.2033 0.8941
Category:Sex 3 0.0089 0.0089 1 169.32 0.2871 0.5928
Category 0 0.0453 0.0453 1 170.33 1.4653 0.2278
T0_weight_norm 0 10.2728 10.2728 1 180.04 332.3250 < 2.2e-16 ***
Sex:Day_factor 0 1.1262 0.3754 3 540.45 12.1439 1.059e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
weight_norm ~ Category + Sex + Day_factor + T0_weight_norm + (1 | Batch) + (1 | Batch:MouseID_factor) + Sex:Day_factor
–> not significant for catgeoty or interactions of category wirth other variables –> no treatment effect on weight
metadata_gain <- metadata %>%
dplyr::mutate(T0_fatperc = T0_fatmass/T0_weight*100,
T4_fatperc = T4_fatmass/T4_weight*100,
adiposity_gain = T4_fatperc - T0_fatperc) %>%
dplyr::select(MouseID, Sex, Batch, Category, Litter, Promethion_Cabinet, T0_fatperc, T4_fatperc, T0_weight, adiposity_gain)
Fig1_adiposity <- metadata_gain %>%
ggplot(aes(x = Category, y = adiposity_gain, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adiposity gain (%)") +
theme(axis.text.x = element_text(face = "italic"))
Fig1_adiposity
statistical analysis
options(contrasts=c("contr.sum", "contr.poly"))
model_adiposity_gain <- lmerTest::lmer(adiposity_gain ~ Category*Sex + T0_fatperc*T0_weight +(1|Batch/Sex), data = metadata_gain)
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -2.9e-03
lmerTest::step(model_adiposity_gain, keep = "Category")
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 10 -406.30 832.61
(1 | Sex:Batch) 1 9 -406.30 830.61 0.0000 1 1.0000
(1 | Batch) 2 8 -407.33 830.66 2.0528 1 0.1519
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Category:Sex 1 1 0.109 1729.2 381.59 0.0092 0.92387
Sex 2 1 0.141 1729.3 379.60 0.0119 0.91334
T0_fatperc:T0_weight 3 1 15.273 1744.6 378.94 1.2983 0.25638
T0_fatperc 4 1 4.478 1749.0 377.33 0.3799 0.53861
T0_weight 5 1 37.965 1787.0 378.59 3.2342 0.07414 .
Category 0 1 5.387 1792.4 377.05 0.4522 0.50234
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
adiposity_gain ~ Category
model_adiposity_gain.2 <- lm(adiposity_gain ~ Category+ T0_fatperc, data = metadata_gain)
stats::shapiro.test(resid(model_adiposity_gain.2)) # test normality of residuals
Shapiro-Wilk normality test
data: resid(model_adiposity_gain.2)
W = 0.99489, p-value = 0.8761
anova(lm(residuals(model_adiposity_gain.2)~fitted.values(model_adiposity_gain.2))) # test for heteroscedasticity
Analysis of Variance Table
Response: residuals(model_adiposity_gain.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_adiposity_gain.2) 1 0.0 0.000 0 1
Residuals 150 1784.4 11.896
plot(model_adiposity_gain.2)
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_adiposity_gain.2, test.statistic="F", type = "III")
Anova Table (Type III tests)
Response: adiposity_gain
Sum Sq Df F value Pr(>F)
(Intercept) 309.97 1 25.8828 1.076e-06 ***
Category 5.85 1 0.4887 0.4856
T0_fatperc 2.58 1 0.2155 0.6432
Residuals 1784.43 149
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
-> no treatment effect
Promethion_Food <- Promethion.2 %>%
dplyr::filter(MouseID != 6438, MouseID != 6450) %>% # spilled food into cage, as mouse was not eating from hopper
dplyr::filter(Date_common == as.POSIXct("2020-05-04 08:00:00")) %>% # filter endpoint data to obtain food eaten at the end of the experiment
tidyr::drop_na(Promethion_weight) %>%
dplyr::mutate(Food_corrected = FoodInA_M - Spilled_Food_cage,
FI_kcal = Food_corrected*3.406557,
FI_kcal_day = FI_kcal/70*24,
FI_kcal_day_BW = FI_kcal_day/Promethion_weight) %>%
dplyr::group_by(Sex) %>% # exclude outliers, as spilled food might have measurement errors
dplyr::mutate(lower_bound_FI_kcal_day_BW = median(FI_kcal_day_BW) - 3.5 *mad(FI_kcal_day_BW),
upper_bound_FI_kcal_day_BW = median(FI_kcal_day_BW) + 3.5 * mad(FI_kcal_day_BW)) %>%
dplyr::ungroup() %>%
dplyr::group_by(MouseID) %>%
dplyr::filter(dplyr::between(FI_kcal_day_BW, lower_bound_FI_kcal_day_BW, upper_bound_FI_kcal_day_BW)) %>%
dplyr::ungroup() %>%
dplyr::mutate(Feed_eficiency = ((T6_weight - T0_weight)/28)/FI_kcal_day)
Fig1_foodintake_weight<- Promethion_Food %>%
ggplot(aes(x= Promethion_weight ,y=FI_kcal_day, color = Category, group = Category)) +
geom_smooth( method = "lm", se = F, alpha = 0.8, size = 0.5, show.legend = F)+
geom_point(aes(shape = Sex), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=c(16, 4), name = "Sex", label = c("Female", "Male")) +
scale_color_manual(values=c(color_Category), label = c("Killed-CM", "Live-CM"), name = "Treatment") +
theme_classic(base_size = 10) +
labs(y = "Food intake (kcal/d)", x = "Weight (g)")
Fig1_foodintake_weight
Higher food intake
Statistical analysis:
set.seed(628)
Promethion_Food$FI_kcal_day_norm <- predict(bestNormalize(Promethion_Food$FI_kcal_day))
Promethion_Food$Promethion_weight_norm <- predict(bestNormalize(Promethion_Food$Promethion_weight))
options(contrasts=c("contr.sum", "contr.poly"))
model_food <- lmerTest::lmer(FI_kcal_day_norm ~ Category*Sex + Sex*Promethion_weight_norm + (Category|Batch/Sex/Promethion_Cabinet), data = Promethion_Food)
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_food, keep = "Category")
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -2.8e-03boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.9e-01boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 16 -219.15 470.29
Category in (Category | Sex:Batch) 1 14 -219.15 466.29 0.00000 2 1.0000
(1 | Sex:Batch) 2 13 -219.15 464.29 0.00000 1 1.0000
Category in (Category | Batch) 3 11 -219.15 460.29 0.00000 2 1.0000
Category in (Category | Promethion_Cabinet:(Sex:Batch)) 4 9 -219.75 457.50 1.20694 2 0.5469
(1 | Promethion_Cabinet:(Sex:Batch)) 5 8 -219.75 455.50 0.00000 1 1.0000
(1 | Batch) 6 7 -219.75 453.50 0.00072 1 0.9786
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Category:Sex 1 1 0.0019 117.19 -53.244 0.0026 0.9593051
Sex:Promethion_weight_norm 2 1 0.2236 117.41 -54.920 0.3148 0.5755352
Category 0 1 2.6423 120.05 -53.137 3.7358 0.0549586 .
Sex 0 1 9.9013 127.31 -43.157 13.9988 0.0002517 ***
Promethion_weight_norm 0 1 3.9688 121.38 -51.269 5.6112 0.0189955 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
FI_kcal_day_norm ~ Category + Sex + Promethion_weight_norm
options(contrasts=c("contr.sum", "contr.poly"))
model_food.2 <- lm(FI_kcal_day_norm ~ Category+Sex+Promethion_weight_norm, data = Promethion_Food)
stats::shapiro.test(residuals(model_food.2))
Shapiro-Wilk normality test
data: residuals(model_food.2)
W = 0.98681, p-value = 0.1106
anova(lm(residuals(model_food.2)~fitted.values(model_food.2)))
Analysis of Variance Table
Response: residuals(model_food.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_food.2) 1 0.00 0.00000 0 1
Residuals 168 117.41 0.69887
plot(model_food.2)
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_food.2, test.statistic="F", type = "II")
Anova Table (Type II tests)
Response: FI_kcal_day_norm
Sum Sq Df F value Pr(>F)
Category 2.642 1 3.7358 0.0549586 .
Sex 9.901 1 13.9988 0.0002517 ***
Promethion_weight_norm 3.969 1 5.6112 0.0189955 *
Residuals 117.411 166
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_food_eff <- lm(FI_kcal_day ~ Category+Sex+Promethion_weight, data = Promethion_Food)
effects::effect("Category", model_food_eff, se =TRUE) %>% as.data.frame()
(14.25670-13.59437)
[1] 0.66233
(14.25670-13.59437)/13.59437*100
[1] 4.87209
model_food.residuals <- lm(FI_kcal_day_norm ~ Sex + Promethion_weight_norm, data = Promethion_Food)
Promethion_Food$FI_kcal_day_residuals <- residuals(model_food.residuals)/sigma(model_food.residuals)
Fig1_foodintake_resid <- Promethion_Food %>%
ggplot(aes(x = Category, y = FI_kcal_day_residuals, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. food intake") +
theme(axis.text.x = element_text(face = "italic"))
Fig1_foodintake_resid
Fig1_feed_eff<- Promethion_Food %>%
ggplot(aes(x = Category, y = Feed_eficiency, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Feed efficicency (g/kcal)") +
theme(axis.text.x = element_text(face = "italic"))
Fig1_feed_eff
Lower feed efficiency Statistical analysis:
set.seed(8765)
Promethion_Food$Feed_eficiency_norm <- predict(bestNormalize(Promethion_Food$Feed_eficiency))
options(contrasts=c("contr.sum", "contr.poly"))
model_feed_eff <- lmer(Feed_eficiency_norm ~ Sex*Category + (Category |Batch/Sex/Promethion_Cabinet), data = Promethion_Food)
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.8e-03
step(model_feed_eff, keep = "Category")
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.7e-03boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 14 -227.99 483.98
Category in (Category | Sex:Batch) 1 12 -227.99 479.98 0.0000 2 1.0000
(1 | Sex:Batch) 2 11 -227.99 477.98 0.0000 1 1.0000
Category in (Category | Promethion_Cabinet:(Sex:Batch)) 3 9 -228.01 474.02 0.0434 2 0.9786
(1 | Promethion_Cabinet:(Sex:Batch)) 4 8 -228.01 472.02 0.0000 1 1.0000
Category in (Category | Batch) 5 6 -228.40 468.79 0.7687 2 0.6809
(1 | Batch) 0 5 -243.68 497.35 30.5565 1 3.243e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Sex:Category 1 0.9106 0.9106 1 156.499 1.2589 0.26357
Sex 2 0.3354 0.3354 1 10.065 0.4628 0.51166
Category 0 3.6370 3.6370 1 157.522 5.0187 0.02647 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Feed_eficiency_norm ~ Category + (1 | Batch)
model_feed_eff.2 <- lmer(Feed_eficiency_norm ~ Category + (1 | Batch), data = Promethion_Food)
stats::shapiro.test(residuals(model_feed_eff.2))
Shapiro-Wilk normality test
data: residuals(model_feed_eff.2)
W = 0.9927, p-value = 0.5503
anova(lm(residuals(model_feed_eff.2)~fitted.values(model_feed_eff.2)))
Analysis of Variance Table
Response: residuals(model_feed_eff.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_feed_eff.2) 1 1.107 1.1073 1.6327 0.2031
Residuals 168 113.937 0.6782
plot(model_feed_eff.2)
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_feed_eff.2, test.statistic="F", type = "II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Feed_eficiency_norm
F Df Df.res Pr(>F)
Category 5.0157 1 157.49 0.02652 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_feed_eff_eff <- lmer(Feed_eficiency ~ Category + (1 | Batch), data = Promethion_Food)
effects::effect("Category", model_feed_eff_eff)
Category effect
Category
Killed Live
0.01919142 0.01719512
as.data.frame(effect("Category", model_feed_eff_eff, se = TRUE))
metadata_bc <- metadata %>%
dplyr::mutate(bombcal_Calorific_Value_kcal = bombcal_Calorific_Value/4184, # convert bombcal_Calorific_Value from J/g to kcal/g
bombcal_Calorific_Value_kcal_total = bombcal_Calorific_Value_kcal*bombcal_Dry_sample_mass, # total energy content of 3 days in metabolic cages
bombcal_Calorific_Value_kcal_total_day = bombcal_Calorific_Value_kcal_total/70*24, # calculate daily energy excretion
bombcal_weight = bombcal_Calorific_Value_kcal_total_day / Promethion_weight) %>% # normalization by murine body weight for outlier detection
tidyr::drop_na(bombcal_weight) %>%
dplyr::group_by() %>%
dplyr::mutate(lower_bound_bombcal_weight= median(bombcal_weight, rm.na = TRUE) - 3 *mad(bombcal_weight),
upper_bound_bombcal_weight = median(bombcal_weight, rm.na = TRUE) + 3 * mad(bombcal_weight)) %>%
dplyr::group_by(MouseID) %>%
dplyr::filter(dplyr::between(bombcal_weight, lower_bound_bombcal_weight, upper_bound_bombcal_weight)) %>% # exclude outliers
dplyr::ungroup()
metadata_bc%>%
ggplot(aes(x = Category, y = bombcal_Dry_sample_mass, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
labs(y = "Fecal mass (g)") +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
theme(axis.text.x = element_text(face = "italic"))
set.seed(628)
metadata_bc$Promethion_weight_norm <- predict(bestNormalize(metadata_bc$Promethion_weight))
metadata_bc$bombcal_Dry_sample_mass_norm <- predict(bestNormalize(metadata_bc$bombcal_Dry_sample_mass))
options(contrasts=c("contr.sum", "contr.poly"))
model_fecal_mass <- lmerTest::lmer(bombcal_Dry_sample_mass_norm ~ Category*Sex + Promethion_weight_norm +(Category|Batch/Sex/Promethion_Cabinet), data = metadata_bc)
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_fecal_mass, keep = "Category")
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -4.6e-04boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -3.8e-01boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 15 -110.05 250.10
Category in (Category | Sex:Batch) 1 13 -110.05 246.10 0.0000 2 1.000000
Category in (Category | Batch) 2 11 -110.05 242.10 0.0002 2 0.999893
(1 | Sex:Batch) 3 10 -110.05 240.10 0.0000 1 1.000000
(1 | Batch) 4 9 -110.05 238.10 0.0000 1 0.999987
Category in (Category | Promethion_Cabinet:(Sex:Batch)) 5 7 -110.28 234.56 0.4645 2 0.792758
(1 | Promethion_Cabinet:(Sex:Batch)) 0 6 -116.09 244.19 11.6298 1 0.000649 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category:Sex 1 1.5791 1.5791 1 73.881 2.8956 0.0930256 .
Sex 2 0.7409 0.7409 1 19.157 1.3193 0.2648533
Category 0 0.2832 0.2832 1 75.248 0.5050 0.4795190
Promethion_weight_norm 0 8.0941 8.0941 1 58.575 14.4345 0.0003475 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
bombcal_Dry_sample_mass_norm ~ Category + Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch))
options(contrasts=c("contr.sum", "contr.poly"))
model_fecal_mass.2 <- lmer(bombcal_Dry_sample_mass_norm ~ Category + Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_bc)
stats::shapiro.test(residuals(model_fecal_mass.2))
Shapiro-Wilk normality test
data: residuals(model_fecal_mass.2)
W = 0.969, p-value = 0.03315
anova(lm(residuals(model_fecal_mass.2)~fitted.values(model_fecal_mass.2)))
Analysis of Variance Table
Response: residuals(model_fecal_mass.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_fecal_mass.2) 1 0.576 0.57595 1.1625 0.284
Residuals 86 42.607 0.49543
plot(model_fecal_mass.2)
car::Anova(model_fecal_mass.2, test.statistic="F", type = "II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: bombcal_Dry_sample_mass_norm
F Df Df.res Pr(>F)
Category 0.5036 1 75.173 0.4801212
Promethion_weight_norm 13.1062 1 58.418 0.0006165 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_fecal_mass_resid <- lmer(bombcal_Dry_sample_mass_norm ~ Sex + Promethion_weight_norm+ (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_bc)
metadata_bc$bombcal_Dry_sample_mass_resid <- residuals(model_fecal_mass_resid)/sigma(model_fecal_mass_resid)
FigS2_fecal_mass <- metadata_bc%>%
ggplot(aes(x = Category, y = bombcal_Dry_sample_mass_resid, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. fecal mass") +
theme(axis.text.x = element_text(face = "italic"))
FigS2_fecal_mass
-> no difference between treatment groups
metadata_bc %>%
ggplot(aes(x= Promethion_weight ,y=bombcal_Calorific_Value_kcal_total_day, color = Category, group = Category)) +
geom_smooth( method = "lm", se = F, alpha = 0.8, size = 0.5, show.legend = F)+
geom_point(aes(shape = Sex), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=c(16, 4), name = "Sex", label = c("Female", "Male")) +
scale_color_manual(values=c(color_Category), name = "Treatment", label = c("Killed-CM", "Live-CM")) +
theme_classic(base_size = 10) +
labs(y = "Fecal Energy (kcal/g/d)", x = "Weight (g)")
set.seed(628)
metadata_bc$bombcal_Calorific_Value_kcal_total_day_norm <- predict(bestNormalize(metadata_bc$bombcal_Calorific_Value_kcal_total_day))
options(contrasts=c("contr.sum", "contr.poly"))
model_Bomb_cal <- lmerTest::lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ Category*Sex + Promethion_weight_norm +(Category|Batch/Sex/Promethion_Cabinet), data = metadata_bc)
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_Bomb_cal, keep = "Category")
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -9.5e-02boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.7e-01boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 15 -112.34 254.67
Category in (Category | Sex:Batch) 1 13 -112.34 250.67 0.0000 2 1.00000
Category in (Category | Batch) 2 11 -112.35 246.70 0.0243 2 0.98793
(1 | Sex:Batch) 3 10 -112.35 244.70 0.0000 1 1.00000
(1 | Batch) 4 9 -112.35 242.70 0.0000 1 0.99998
Category in (Category | Promethion_Cabinet:(Sex:Batch)) 5 7 -112.42 238.83 0.1379 2 0.93336
(1 | Promethion_Cabinet:(Sex:Batch)) 0 6 -116.55 245.10 8.2613 1 0.00405 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category:Sex 1 1.1012 1.1012 1 74.155 1.8706 0.1755404
Sex 2 0.3468 0.3468 1 21.090 0.5803 0.4546367
Category 0 0.0772 0.0772 1 75.677 0.1295 0.7199197
Promethion_weight_norm 0 10.4462 10.4462 1 49.255 17.5286 0.0001165 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
bombcal_Calorific_Value_kcal_total_day_norm ~ Category + Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch))
options(contrasts=c("contr.sum", "contr.poly"))
model_Bomb_cal.2 <- lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ Category + Promethion_weight_norm+ (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_bc)
stats::shapiro.test(residuals(model_Bomb_cal.2))
Shapiro-Wilk normality test
data: residuals(model_Bomb_cal.2)
W = 0.98781, p-value = 0.5867
anova(lm(residuals(model_Bomb_cal.2)~fitted.values(model_Bomb_cal.2)))
Analysis of Variance Table
Response: residuals(model_Bomb_cal.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_Bomb_cal.2) 1 0.575 0.57495 1.0799 0.3016
Residuals 86 45.788 0.53242
plot(model_Bomb_cal.2)
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_Bomb_cal.2, test.statistic="F", type = "II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: bombcal_Calorific_Value_kcal_total_day_norm
F Df Df.res Pr(>F)
Category 0.1291 1 75.434 0.7203622
Promethion_weight_norm 15.7971 1 48.654 0.0002331 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_Bomb_cal_resid <- lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ Sex + Promethion_weight_norm+ (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_bc)
metadata_bc$bombcal_Calorific_Value_kcal_total_day_resid <- residuals(model_Bomb_cal_resid)/sigma(model_Bomb_cal_resid)
Fig1_fecal_energy <- metadata_bc%>%
ggplot(aes(x = Category, y = bombcal_Calorific_Value_kcal_total_day_resid, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. fecal energy conetnt") +
theme(axis.text.x = element_text(face = "italic"))
Fig1_fecal_energy
-> no difference between treatment groups ### Figure 1 - Effects of live or heat-killed C. minuta amendment to fecal transplants to GF mice on C. minuta, murine adiposity, feed efficiency and fecal energy loss four weeks post inoculation.
Legend_treatment_sex <- cowplot::get_legend(metadata_Cmin %>%
dplyr::mutate(Sex = ifelse(Sex == "F", "Female", "Male"),
Category = ifelse(Category == "Killed", "Killed-CM", "Live-CM"),
Sex_Category = paste(Sex, Category, sep = " ")) %>%
ggplot(aes(x = Category, y = qPCR_Cmin_per_gCC, shape = Sex_Category, color = Sex_Category)) +
geom_point(aes(shape = Sex_Category, color= Sex_Category), alpha =0.7, size =0.5, show.legend = T) +
scale_shape_manual(values=c(16, 16,4, 4)) +
scale_color_manual(values=c(color_Category, color_Category)) +
theme_classic(base_size = 10) +
guides(shape = guide_legend(override.aes = list(size = 3, alpha = 1))) +
theme(legend.title=element_blank()))
Fig1_align <- cowplot::align_plots(Fig1_qPCR_Cmin + theme(legend.position="none"),
Fig1_adiposity + theme(legend.position="none"),
Fig1_foodintake_weight + theme(legend.position="none"),
Fig1_foodintake_resid + theme(legend.position="none"),
Fig1_feed_eff + theme(legend.position="none"),
Fig1_fecal_energy + theme(legend.position="none"),
align = 'hv', axis = 'tblr')
Warning: Removed 32 rows containing non-finite values (stat_summary).Warning: Removed 32 rows containing missing values (position_quasirandom).`geom_smooth()` using formula 'y ~ x'
Fig1_1 <- cowplot::plot_grid(Fig1_align[[1]],
Fig1_align[[2]],
Fig1_align[[5]],
Fig1_align[[6]],
ncol=2, nrow=2, labels = c("B", "C", "F", "G"),label_size = 12, rel_widths = c(1,1), rel_heights = c(1,1))
Fig1_2 <- cowplot::plot_grid(Fig1_align[[4]],
Legend_treatment_sex,
ncol=1, nrow=2, labels = c("E", NA),label_size = 12, rel_heights = c(1,1))
Fig1_3 <- cowplot::plot_grid(Fig1_align[[3]],
Fig1_2,
ncol=2, nrow=1, labels = c("D", NA),label_size = 12, rel_widths = c(1,1))
Warning: Removed 1 rows containing missing values (geom_text).
Figure1 <- cowplot::plot_grid(Fig1_1,
Fig1_3,
ncol=2, nrow = 1, rel_widths = c(1,1))
Warning: Removed 1 rows containing missing values (geom_text).
Figure1
ggsave("./Figure1.pdf", plot = Figure1, device = cairo_pdf,
width = 17,
height = 10.5,
units = "cm")
FigS2_align <- cowplot::align_plots(FigS2_weight + theme(legend.position="none"),
FigS2_fecal_mass + theme(legend.position="none"),
align = 'hv', axis = 'tblr')
FigureS2 <- cowplot::plot_grid(FigS2_align[[1]],
FigS2_align[[2]],
Legend_treatment_sex,
ncol=3, nrow=1, labels = c("A", "B", NA),label_size = 12, rel_widths = c(1.5,1, 0.75))
FigureS2
ggsave("./FigureS2.pdf", plot = Fig_supp.fe, device = cairo_pdf,
width = 13,
height = 6.5,
units = "cm")
For the activity data the acclimatization period is removed, as activity is highly influenced by stress
Promethion_activity_ee <- Promethion.2 %>% # create a common dataset to calculate EE and activity
base::subset(Date_common >= as.POSIXct('2020-05-02 08:00:00') & Date_common <= as.POSIXct('2020-05-04 08:00:00')) %>% # exclude acclimatization period and end of experiment
dplyr::mutate(PedSpeed_Mnz = ifelse(PedSpeed_Mnz > 0, PedSpeed_Mnz, NA)) %>% # exclude speed when animals where not running
dplyr::group_by(MouseID) %>%
dplyr::summarise(Distance_traveled = sum(AllMeters_R),
Beam_breaks = sum(XBreak_R) + sum(YBreak_R) + sum(ZBreak_R),
mean_running_speed = mean(PedSpeed_Mnz, na.rm=TRUE),
EE_average_per_hour = mean(kcal_hr_M)) %>%
dplyr::ungroup() %>%
dplyr::left_join(metadata, by ="MouseID")
Promethion_activity <- Promethion_activity_ee %>% # exclude mice with suspicious activity measurements
dplyr::group_by(Batch) %>%
dplyr::mutate(lower_bound_Distance_traveled = median(Distance_traveled) - 3 * mad(Distance_traveled),
upper_bound_Distance_traveled = median(Distance_traveled) + 3 * mad(Distance_traveled),
lower_bound_Beam_breaks = median(Beam_breaks) - 3 * mad(Beam_breaks),
upper_bound_Beam_breaks = median(Beam_breaks) + 3 * mad(Beam_breaks)) %>%
dplyr::ungroup() %>%
dplyr::group_by(MouseID) %>%
dplyr::filter(dplyr::between(Distance_traveled, lower_bound_Distance_traveled, upper_bound_Distance_traveled) |
dplyr::between(Beam_breaks, lower_bound_Beam_breaks, upper_bound_Beam_breaks)) %>%
dplyr::ungroup()
Promethion_activity %>%
ggplot(aes(x = Category, y = Beam_breaks, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "# Beam breaks") +
theme(axis.text.x = element_text(face = "italic"))
options(contrasts=c("contr.sum", "contr.poly"))
model_Beam_breaks<-(lmer(Beam_breaks ~ Category*Sex + (Category|Batch/Sex/Promethion_Cabinet), Promethion_activity))
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.2e-03
step(model_Beam_breaks, keep ="Category")
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.5e-03boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 14 -2043.9 4115.8
Category in (Category | Sex:Batch) 1 12 -2043.9 4111.8 0.002 2 0.9991
(1 | Sex:Batch) 2 11 -2043.9 4109.8 -0.002 1 1.0000
Category in (Category | Batch) 3 9 -2044.0 4105.9 0.147 2 0.9292
Category in (Category | Promethion_Cabinet:(Sex:Batch)) 4 7 -2044.3 4102.6 0.680 2 0.7116
(1 | Promethion_Cabinet:(Sex:Batch)) 5 6 -2044.9 4101.8 1.191 1 0.2751
(1 | Batch) 0 5 -2071.5 4153.1 53.259 1 2.924e-13 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category:Sex 1 22646547 22646547 1 169.185 0.0591 0.808218
Category 0 2647923943 2647923943 1 170.178 6.9489 0.009163 **
Sex 0 1917488030 1917488030 1 10.077 5.0320 0.048544 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Beam_breaks ~ Category + Sex + (1 | Batch)
options(contrasts=c("contr.sum", "contr.poly"))
model_Beam_breaks.2<-(lmerTest::lmer(Beam_breaks ~ Category + Sex + (1 | Batch), Promethion_activity))
stats::shapiro.test(resid(model_Beam_breaks.2))
Shapiro-Wilk normality test
data: resid(model_Beam_breaks.2)
W = 0.99105, p-value = 0.3134
anova(lm(residuals(model_Beam_breaks.2)~fitted.values(model_Beam_breaks.2)))
Analysis of Variance Table
Response: residuals(model_Beam_breaks.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_Beam_breaks.2) 1 2.1460e+08 214596001 0.5981 0.4403
Residuals 181 6.4937e+10 358767710
plot(model_Beam_breaks.2)
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_Beam_breaks.2, type="II", test.statistic="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Beam_breaks
F Df Df.res Pr(>F)
Category 6.9480 1 170.1 0.009167 **
Sex 5.0319 1 10.0 0.048740 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
effects::effect("Category", model_Beam_breaks.2, se =TRUE) %>% as.data.frame()
(119692.2-112072.3)/112072.3*100
[1] 6.799093
model_Beam_breaks.residuals <-(lmerTest::lmer(Beam_breaks ~ Sex + (1 | Batch), Promethion_activity))
Promethion_activity$Beam_breaks_residuals <- residuals(model_Beam_breaks.residuals)/sigma(model_Beam_breaks.residuals)
Fig2_beam_breaks <- Promethion_activity %>%
ggplot(aes(x = Category, y = Beam_breaks_residuals, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. beam breaks") +
theme(axis.text.x = element_text(face = "italic"))
Fig2_beam_breaks
-> significant more beam breaks by treatment
Promethion_activity %>%
ggplot(aes(x = Category, y = Distance_traveled, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Distance traveled (m)") +
theme(axis.title.x=element_blank()) +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(Sex~.) +
theme(strip.background = element_blank(),
strip.text = element_blank()) +
theme(axis.text.x = element_text(face = "italic"))
–> although not statistically significant, exact analysis of data results in assumption of different treatment effects in males and females –> separate statistical analysis
options(contrasts=c("contr.sum", "contr.poly"))
Promethion_activity_M <- Promethion_activity %>% dplyr::filter(Sex =="M")
Promethion_activity_F <- Promethion_activity %>% dplyr::filter(Sex =="F")
model_Distance_traveled.m<-(lmerTest::lmer(Distance_traveled_norm ~ Category + (1 | Batch), Promethion_activity_M))
stats::shapiro.test(resid(model_Distance_traveled.m))
Shapiro-Wilk normality test
data: resid(model_Distance_traveled.m)
W = 0.97503, p-value = 0.08364
anova(lm(residuals(model_Distance_traveled.m)~fitted.values(model_Distance_traveled.m)))
Analysis of Variance Table
Response: residuals(model_Distance_traveled.m)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_Distance_traveled.m) 1 0.214 0.21431 0.5092 0.4774
Residuals 87 36.616 0.42087
model_Distance_traveled.f<-(lmerTest::lmer(Distance_traveled_norm ~ Category + (1 | Batch), Promethion_activity_F))
stats::shapiro.test(resid(model_Distance_traveled.f))
Shapiro-Wilk normality test
data: resid(model_Distance_traveled.f)
W = 0.95915, p-value = 0.00503
anova(lm(residuals(model_Distance_traveled.f)~fitted.values(model_Distance_traveled.f)))
Analysis of Variance Table
Response: residuals(model_Distance_traveled.f)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_Distance_traveled.f) 1 0.337 0.33669 0.5234 0.4712
Residuals 92 59.180 0.64326
car::Anova(model_Distance_traveled.m, test.statistic ="F", type="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Distance_traveled_norm
F Df Df.res Pr(>F)
Category 4.6931 1 82.118 0.03318 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_Distance_traveled.f, test.statistic ="F", type="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Distance_traveled_norm
F Df Df.res Pr(>F)
Category 0.0194 1 87 0.8897
model_Distance_traveled.meff<-(lmerTest::lmer(Distance_traveled ~ Category + (1 | Batch), Promethion_activity_M))
effects::effect("Category", model_Distance_traveled.meff, se =TRUE) %>% as.data.frame
model_Distance_traveled.feff<-(lmerTest::lmer(Distance_traveled ~ Category + (1 | Batch), Promethion_activity_F))
effects::effect("Category", model_Distance_traveled.feff, se =TRUE) %>% as.data.frame
model_Distance_traveled.m_residuals <-(lmerTest::lmer(Distance_traveled_norm ~ (1 | Batch), Promethion_activity_M))
model_Distance_traveled.f_residuals <-(lmerTest::lmer(Distance_traveled_norm ~ (1 | Batch), Promethion_activity_F))
Promethion_activity_M$Distance_traveled_residuals <- residuals(model_Distance_traveled.m_residuals)/sigma(model_Distance_traveled.m_residuals)
Promethion_activity_F$Distance_traveled_residuals <- residuals(model_Distance_traveled.f_residuals)/sigma(model_Distance_traveled.f_residuals)
Promethion_activity_MF<- rbind(Promethion_activity_M, Promethion_activity_F)
Fig2_distance <- Promethion_activity_MF%>%
ggplot(aes(x = Category, y = Distance_traveled_residuals, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. distance traveled", x= "Treatment") +
theme(axis.title.x=element_blank()) +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(Sex~.) +
theme(strip.background = element_blank(),
strip.text = element_blank()) +
theme(axis.text.x = element_text(face = "italic"))
Fig2_distance
FigS3_speed <- Promethion_activity %>%
ggplot(aes(x = Category, y = mean_running_speed, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y ="Mean running speed (m/s)") +
theme(axis.text.x = element_text(face = "italic"))
FigS3_speed
set.seed(874)
Promethion_activity <- Promethion_activity %>%
dplyr::mutate(mean_running_speed_norm = predict(bestNormalize(mean_running_speed)))
model_speed <- lmer(mean_running_speed_norm ~ Category*Sex + Promethion_Cabinet + (1|Batch), data = Promethion_activity)
step(model_speed)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 7 -255.23 524.46
(1 | Batch) 0 6 -257.10 526.20 3.7438 1 0.053 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category:Sex 1 0.0004 0.0004 1 168.17 0.0004 0.98380
Promethion_Cabinet 2 0.1160 0.1160 1 168.75 0.1362 0.71259
Category 3 1.3672 1.3672 1 170.15 1.6129 0.20581
Sex 0 7.6179 7.6179 1 9.71 8.9641 0.01391 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
mean_running_speed_norm ~ Sex + (1 | Batch)
model_speed.2 <- lmer(mean_running_speed_norm ~ Category + Sex + (1|Batch), data = Promethion_activity)
shapiro.test(residuals(model_speed.2))
Shapiro-Wilk normality test
data: residuals(model_speed.2)
W = 0.98784, p-value = 0.1176
anova(lm(residuals(model_speed.2)~fitted.values(model_speed.2)))
Analysis of Variance Table
Response: residuals(model_speed.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_speed.2) 1 0.915 0.91534 1.1278 0.2897
Residuals 181 146.908 0.81165
plot(model_speed.2)
car::Anova(model_speed.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: mean_running_speed_norm
F Df Df.res Pr(>F)
Category 1.6121 1 170.444 0.20593
Sex 9.0239 1 9.995 0.01326 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_speed.eff <- lmer(mean_running_speed ~ Category + Sex + (1|Batch), data = Promethion_activity)
effects::effect("Category", model_speed.eff, se =TRUE) %>% as.data.frame()
Promethion_activity_MF_Cmin<- Promethion_activity_MF %>%
dplyr::left_join(qPCR_data, by ="MouseID")
Promethion_activity_MF_Cmin %>%
ggplot(aes(x= qPCR_Cmin_per_gCC ,y=Beam_breaks_residuals)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10) +
labs(y= "Adj. beam breaks",
x = "Norm. C. minuta")
Promethion_activity_MF_Cmin %>%
ggplot(aes(x= qPCR_Cmin_per_gCC ,y=Distance_traveled_residuals)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10) +
labs(y= "Adj. distance traveled",
x = "Norm. C. minuta") +
theme(strip.background = element_blank(),
strip.text = element_blank()) +
facet_wrap(.~Sex, scales = "free", ncol =1)
set.seed(710)
Promethion_activity_MF_Cmin.2 <- Promethion_activity_MF_Cmin %>%
tidyr::drop_na(qPCR_Cmin_per_gCC) %>%
dplyr::mutate(qPCR_Cmin_per_gCC_norm = predict(bestNormalize(qPCR_Cmin_per_gCC)))
model_bb_cmin<-(lmer(Beam_breaks ~ qPCR_Cmin_per_gCC_norm*Sex + qPCR_Round + (1 |Batch/Sex/Promethion_Cabinet) + (1 |Batch:Promethion_Cabinet) + (1 |Promethion_Cabinet), Promethion_activity_MF_Cmin.2))
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -3.3e-03
lmerTest::step(model_bb_cmin)
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -4.8e-04boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -4.2e-04Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -4.2e-04
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 11 -2012.6 4047.2
(1 | Promethion_Cabinet:(Sex:Batch)) 1 10 -2012.6 4045.2 0.0000 1 1.0000
(1 | Promethion_Cabinet) 2 9 -2012.6 4043.2 0.0000 1 1.0000
(1 | Sex:Batch) 3 8 -2012.6 4041.2 0.0000 1 1.0000
(1 | Batch:Promethion_Cabinet) 4 7 -2013.2 4040.5 1.2422 1 0.2651
(1 | Batch) 0 6 -2028.2 4068.4 29.9631 1 4.404e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
qPCR_Cmin_per_gCC_norm:Sex 1 1144708 1144708 1 175.564 0.0029 0.95725
qPCR_Round 2 529054745 529054745 1 12.972 1.3388 0.26810
qPCR_Cmin_per_gCC_norm 0 1871160245 1871160245 1 177.686 4.7537 0.03055 *
Sex 0 2365731335 2365731335 1 9.706 6.0102 0.03484 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Beam_breaks ~ qPCR_Cmin_per_gCC_norm + Sex + (1 | Batch)
model_distance_cmin<-(lmer(Distance_traveled ~ qPCR_Cmin_per_gCC_norm*Sex + qPCR_Round + (1 |Batch/Sex/Promethion_Cabinet) + (1 |Batch:Promethion_Cabinet) + (1 |Promethion_Cabinet), Promethion_activity_MF_Cmin.2))
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_distance_cmin)
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -4.2e-03boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -4.2e-03boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -3.7e-01boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -3.3e-04Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -9.6e-05Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -9.6e-05
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 11 -1072.6 2167.2
(1 | Promethion_Cabinet:(Sex:Batch)) 1 10 -1072.6 2165.2 0.0000 1 1.0000
(1 | Promethion_Cabinet) 2 9 -1072.6 2163.2 0.0000 1 1.0000
(1 | Sex:Batch) 3 8 -1072.6 2161.2 0.0000 1 0.9999
(1 | Batch:Promethion_Cabinet) 4 7 -1072.9 2159.8 0.6783 1 0.4102
(1 | Batch) 0 6 -1087.7 2187.4 29.5386 1 5.481e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
qPCR_Cmin_per_gCC_norm:Sex 1 13717 13717 1 175.348 1.5059 0.22141
qPCR_Cmin_per_gCC_norm 2 222 222 1 173.631 0.0242 0.87662
qPCR_Round 3 17309 17309 1 11.898 1.8993 0.19352
Sex 0 48172 48172 1 10.118 5.3086 0.04367 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Distance_traveled ~ Sex + (1 | Batch)
-> association between beam breaks and C. minuta for both sexes -> for distance traveled there might be only an association in males –> separate analysis #### Beam breaks ~ C. minuta
model_bb_cmin.2<-(lmer(Beam_breaks ~ qPCR_Cmin_per_gCC_norm + Sex + (1 | Batch), Promethion_activity_MF_Cmin.2))
shapiro.test(residuals(model_bb_cmin.2))
Shapiro-Wilk normality test
data: residuals(model_bb_cmin.2)
W = 0.98947, p-value = 0.2015
anova(lm(residuals(model_bb_cmin.2)~fitted.values(model_bb_cmin.2)))
Analysis of Variance Table
Response: residuals(model_bb_cmin.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_bb_cmin.2) 1 2.2116e+08 221163295 0.5962 0.441
Residuals 179 6.6399e+10 370944778
car::Anova(model_bb_cmin.2, type ="II", test.statistic="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Beam_breaks
F Df Df.res Pr(>F)
qPCR_Cmin_per_gCC_norm 4.6652 1 177.69 0.03212 *
Sex 6.0101 1 9.91 0.03437 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
set.seed(765)
r2_model_bb_cmin_mar<- partR2(model_bb_cmin.2, partvars = c("qPCR_Cmin_per_gCC_norm"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_bb_cmin_mar$R2 %>% dplyr::filter(term == "qPCR_Cmin_per_gCC_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.01843388
model_bb_cmin.resid<-(lmer(Beam_breaks ~ Sex + (1 | Batch), Promethion_activity_MF_Cmin.2))
Promethion_activity_MF_Cmin.2 <- Promethion_activity_MF_Cmin.2 %>%
dplyr::mutate(Beam_breaks_cmin_resid = residuals(model_bb_cmin.resid)/sigma(model_bb_cmin.resid))
Fig2_bb_cmin <- Promethion_activity_MF_Cmin.2 %>%
ggplot(aes(x= qPCR_Cmin_per_gCC_norm ,y=Beam_breaks_cmin_resid)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10) +
labs(y= "Adj. beam breaks",
x = "Norm. C. minuta")
Fig2_bb_cmin
Promethion_activity_M2 <- Promethion_activity_MF_Cmin.2 %>%
dplyr::filter(Sex =="M") %>%
dplyr::mutate( Batch_Promethion_Cabinet = paste( Batch, Promethion_Cabinet, sep ="_"))
Promethion_activity_F2 <- Promethion_activity_MF_Cmin.2 %>%
dplyr::filter(Sex =="F")%>%
dplyr::mutate( Batch_Promethion_Cabinet = paste( Batch, Promethion_Cabinet, sep ="_"))
model_distance_cmin_m<- lmer(Distance_traveled_norm ~ qPCR_Cmin_per_gCC_norm + (1 | Batch_Promethion_Cabinet), Promethion_activity_M2)
model_distance_cmin_f<- lmer(Distance_traveled_norm ~ qPCR_Cmin_per_gCC_norm + (1 | Batch_Promethion_Cabinet), Promethion_activity_F2)
shapiro.test(residuals(model_distance_cmin_m))
Shapiro-Wilk normality test
data: residuals(model_distance_cmin_m)
W = 0.98454, p-value = 0.3809
anova(lm(residuals(model_distance_cmin_m)~fitted.values(model_distance_cmin_m)))
Analysis of Variance Table
Response: residuals(model_distance_cmin_m)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_distance_cmin_m) 1 0.713 0.71289 1.933 0.168
Residuals 86 31.717 0.36880
shapiro.test(residuals(model_distance_cmin_f))
Shapiro-Wilk normality test
data: residuals(model_distance_cmin_f)
W = 0.97406, p-value = 0.0606
anova(lm(residuals(model_distance_cmin_f)~fitted.values(model_distance_cmin_f)))
Analysis of Variance Table
Response: residuals(model_distance_cmin_f)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_distance_cmin_f) 1 1.377 1.37658 2.3408 0.1295
Residuals 91 53.515 0.58808
plot(model_distance_cmin_m)
plot(model_distance_cmin_f)
car::Anova(model_distance_cmin_m, test.statistic ="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Distance_traveled_norm
F Df Df.res Pr(>F)
qPCR_Cmin_per_gCC_norm 4.3941 1 80.592 0.0392 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_distance_cmin_f, test.statistic ="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Distance_traveled_norm
F Df Df.res Pr(>F)
qPCR_Cmin_per_gCC_norm 0.1132 1 90.3 0.7374
#r2 males
r2_model_distance_cmin_m_mar<- partR2(model_distance_cmin_m, partvars = c("qPCR_Cmin_per_gCC_norm"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_distance_cmin_m_mar$R2 %>% dplyr::filter(term == "qPCR_Cmin_per_gCC_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.03734531
#r2 females
r2_model_distance_cmin_f_mar<- partR2(model_distance_cmin_f, partvars = c("qPCR_Cmin_per_gCC_norm"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~02s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_distance_cmin_f_mar$R2 %>% dplyr::filter(term == "qPCR_Cmin_per_gCC_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.001360038
model_distance_cmin.resid_M<-(lmer(Distance_traveled_norm ~ + (1 | Batch:Promethion_Cabinet), Promethion_activity_M2))
model_distance_cmin.resid_F<-(lmer(Distance_traveled_norm ~ + (1 | Batch:Promethion_Cabinet), Promethion_activity_F2))
Promethion_activity_M2 <- Promethion_activity_M2 %>%
dplyr::mutate(Distance_traveled_cmin_resid = residuals(model_distance_cmin.resid_M)/sigma(model_distance_cmin.resid_M))
Promethion_activity_F2 <- Promethion_activity_F2 %>%
dplyr::mutate(Distance_traveled_cmin_resid = residuals(model_distance_cmin.resid_F)/sigma(model_distance_cmin.resid_F))
Promethion_activity_MF3 <- rbind(Promethion_activity_M2, Promethion_activity_F2)
Fig2_distance_cmin<- Promethion_activity_MF3 %>%
ggplot(aes(x= qPCR_Cmin_per_gCC_norm ,y=Distance_traveled_cmin_resid)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10) +
labs(y= "Adj. distance traveled",
x = "Norm. C. minuta") +
theme(strip.background = element_blank(),
strip.text = element_blank()) +
facet_wrap(.~Sex, scales = "free", ncol =1)
Fig2_distance_cmin
Promethion_activity_food <- Promethion_Food %>%
dplyr::select(MouseID, Feed_eficiency) %>%
dplyr::left_join(Promethion_activity, by = "MouseID") %>%
tidyr::drop_na(Feed_eficiency, Beam_breaks)
Promethion_activity_food %>%
ggplot(aes(x= Beam_breaks ,y=Feed_eficiency)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5)+
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.5, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10)
Promethion_activity_food %>%
ggplot(aes(x= Distance_traveled ,y=Feed_eficiency)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5)+
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.5, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10) +
facet_grid(.~Sex)
options(contrasts=c("contr.sum", "contr.poly"))
model_fe_bb <- lmer(Feed_eficiency~ Beam_breaks*Sex + (1|Batch), Promethion_activity_food)
Warning: Some predictor variables are on very different scales: consider rescalingWarning: Some predictor variables are on very different scales: consider rescaling
step(model_fe_bb)
Warning: Some predictor variables are on very different scales: consider rescalingWarning: Some predictor variables are on very different scales: consider rescalingWarning: Some predictor variables are on very different scales: consider rescalingWarning: Some predictor variables are on very different scales: consider rescaling
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 583.97 -1155.9
(1 | Batch) 0 5 577.26 -1144.5 13.411 1 0.0002501 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Beam_breaks:Sex 1 7.7590e-05 7.7590e-05 1 160.461 2.5052 0.1154
Sex 2 3.5060e-06 3.5060e-06 1 9.984 0.1137 0.7429
Beam_breaks 3 1.6137e-05 1.6137e-05 1 156.667 0.5237 0.4703
Model found:
Feed_eficiency ~ (1 | Batch)
model_fe_distance <- lmer(Feed_eficiency~ Distance_traveled*Sex + (1|Batch), Promethion_activity_food)
step(model_fe_distance)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 595.94 -1179.9
(1 | Batch) 0 5 587.54 -1165.1 16.792 1 4.171e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Distance_traveled:Sex 0 0.00014076 0.00014076 1 163.78 4.5929 0.03358 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Feed_eficiency ~ Distance_traveled * Sex + (1 | Batch)
set.seed(673)
Promethion_activity_food$Feed_eficiency_norm <- predict(bestNormalize(Promethion_activity_food$Feed_eficiency))
model_fe_bb.2 <- lmer(Feed_eficiency_norm~ Beam_breaks + (1|Batch), Promethion_activity_food)
Warning: Some predictor variables are on very different scales: consider rescalingWarning: Some predictor variables are on very different scales: consider rescaling
shapiro.test(residuals(model_fe_bb.2))
Shapiro-Wilk normality test
data: residuals(model_fe_bb.2)
W = 0.99334, p-value = 0.6357
anova(lm(residuals(model_fe_bb.2)~fitted.values(model_fe_bb.2)))
Analysis of Variance Table
Response: residuals(model_fe_bb.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_fe_bb.2) 1 1.249 1.24913 1.807 0.1807
Residuals 167 115.445 0.69129
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_fe_bb.2, type ="II", test.statistic ="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Feed_eficiency_norm
F Df Df.res Pr(>F)
Beam_breaks 0.3749 1 160.05 0.5412
r2_model_fe_bb_mar<- partR2(model_fe_bb.2, partvars = c("Beam_breaks"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_fe_bb_mar$R2 %>% dplyr::filter(term == "Beam_breaks") %>% dplyr::select(estimate) %>% pull()
[1] 0.002815192
model_fe_bb_resid <- lmer(Feed_eficiency_norm~ (1|Batch), Promethion_activity_food)
Promethion_activity_food <- Promethion_activity_food %>%
dplyr::mutate(Feed_eficiency_bb_resid = residuals(model_fe_bb_resid)/sigma(model_fe_bb_resid))
Fig2_bb_fe <- Promethion_activity_food %>%
ggplot(aes(x= (Beam_breaks/100000) ,y=Feed_eficiency_bb_resid))+
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
geom_point(aes(color= Category, shape = Sex), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
labs(y="Adj. feed efficiency", x=expression(paste("Beam breaks (Nr) x ",e^5))) +
theme_classic(base_size = 10) +
theme(strip.background = element_blank(),
strip.text = element_blank())
Fig2_bb_fe
Seperate models for each sex for Fe ~ distance
set.seed(673)
Promethion_activity_food_M <- Promethion_activity_food %>%
dplyr::filter(Sex =="M") %>%
dplyr::mutate(Feed_eficiency_norm = predict(bestNormalize(Feed_eficiency)))
Promethion_activity_food_F <- Promethion_activity_food %>%
dplyr::filter(Sex =="F") %>%
dplyr::mutate(Feed_eficiency_norm = predict(bestNormalize(Feed_eficiency)))
model_fe_distance_m <- lmer(Feed_eficiency_norm~ Distance_traveled + (1|Batch), Promethion_activity_food_M)
model_fe_distance_f <- lmer(Feed_eficiency_norm~ Distance_traveled + (1|Batch), Promethion_activity_food_F)
shapiro.test(residuals(model_fe_distance_m))
Shapiro-Wilk normality test
data: residuals(model_fe_distance_m)
W = 0.99171, p-value = 0.8751
shapiro.test(residuals(model_fe_distance_f))
Shapiro-Wilk normality test
data: residuals(model_fe_distance_f)
W = 0.98873, p-value = 0.6757
anova(lm(residuals(model_fe_distance_m)~fitted.values(model_fe_distance_m)))
Analysis of Variance Table
Response: residuals(model_fe_distance_m)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_fe_distance_m) 1 1.030 1.02994 1.2525 0.2663
Residuals 82 67.427 0.82228
anova(lm(residuals(model_fe_distance_f)~fitted.values(model_fe_distance_f)))
Analysis of Variance Table
Response: residuals(model_fe_distance_f)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_fe_distance_f) 1 0.337 0.33706 0.5269 0.4699
Residuals 83 53.093 0.63968
car::Anova(model_fe_distance_m, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Feed_eficiency_norm
F Df Df.res Pr(>F)
Distance_traveled 2.8518 1 77.557 0.09529 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_fe_distance_f, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Feed_eficiency_norm
F Df Df.res Pr(>F)
Distance_traveled 1.3974 1 82.996 0.2405
#r2 males
r2_model_fe_distance_m_mar<- partR2(model_fe_distance_m, partvars = c("Distance_traveled"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_fe_distance_m_mar$R2 %>% dplyr::filter(term == "Distance_traveled") %>% dplyr::select(estimate) %>% pull()
[1] 0.03953071
#r2 females
r2_model_fe_distance_f_mar<- partR2(model_fe_distance_f, partvars = c("Distance_traveled"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~02s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_fe_distance_f_mar$R2 %>% dplyr::filter(term == "Distance_traveled") %>% dplyr::select(estimate) %>% pull()
[1] 0.01671485
model_fe_allm_m_resid <- lmer(Feed_eficiency_norm~ (1|Batch), Promethion_activity_food_M)
model_fe_allm_f_resid <- lmer(Feed_eficiency_norm~ (1|Batch), Promethion_activity_food_F)
Promethion_activity_food_M <- Promethion_activity_food_M %>%
dplyr::mutate(Feed_eficiency_distance_resid = residuals(model_fe_allm_m_resid)/sigma(model_fe_allm_m_resid))
Promethion_activity_food_F <- Promethion_activity_food_F %>%
dplyr::mutate(Feed_eficiency_distance_resid = residuals(model_fe_allm_f_resid)/sigma(model_fe_allm_f_resid))
Promethion_activity_food_MF <- rbind(Promethion_activity_food_M, Promethion_activity_food_F)
Fig2_fe_distance <- Promethion_activity_food_MF %>%
ggplot(aes(x= (Distance_traveled/1000) ,y=Feed_eficiency_distance_resid))+
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
geom_point(aes(color= Category, shape = Sex), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
labs(y="Adj. feed efficiency", x="Distance traveled (km)") +
theme_classic(base_size = 10) +
facet_wrap(.~Sex, scales = "free", ncol =1) +
theme(strip.background = element_blank(),
strip.text = element_blank())
Fig2_fe_distance
Fig2_ee_weight<- Promethion_activity_ee %>%
ggplot(aes(x= Promethion_weight ,y=EE_average_per_hour, color= Category, group = Category)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5)+
geom_point(aes(shape = Sex), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10) +
labs(y = "Energy expenditure (kcal/h)", x = "Weight (g)") +
facet_wrap(.~Sex, scales = "free", ncol =1) +
theme(strip.background = element_blank(),
strip.text = element_blank())
Fig2_ee_weight
set.seed(719)
Promethion_activity_ee.2 <- Promethion_activity_ee %>%
drop_na(Promethion_weight)
Promethion_activity_ee.2$Promethion_weight_norm <- predict(bestNormalize(Promethion_activity_ee.2$Promethion_weight))
Promethion_activity_ee.2$EE_average_per_hour_norm<- predict(bestNormalize(Promethion_activity_ee.2$EE_average_per_hour))
options(contrasts=c("contr.sum", "contr.poly"))
model_ee<-(lmer(EE_average_per_hour_norm ~ Category*Sex + Sex*Promethion_weight_norm + (Category |Batch/Sex/Promethion_Cabinet), Promethion_activity_ee.2))
boundary (singular) fit: see help('isSingular')
step(model_ee, keep ="Category")
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -5.0e-03boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.3e-04boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 16 -199.44 430.87
Category in (Category | Sex:Batch) 1 14 -199.44 426.87 0.0000 2 1.0000
(1 | Sex:Batch) 2 13 -199.44 424.87 0.0000 1 1.0000
Category in (Category | Promethion_Cabinet:(Sex:Batch)) 3 11 -199.59 421.18 0.3045 2 0.8588
Category in (Category | Batch) 4 9 -199.74 417.49 0.3097 2 0.8566
(1 | Promethion_Cabinet:(Sex:Batch)) 5 8 -200.34 416.69 1.2039 1 0.2725
(1 | Batch) 0 7 -210.59 435.17 20.4843 1 6.012e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Sex:Promethion_weight_norm 1 0.007 0.007 1 165.965 0.0150 0.9027
Category:Sex 2 1.232 1.232 1 163.665 2.6868 0.1031
Sex 3 0.378 0.378 1 16.250 0.8158 0.3796
Category 0 0.513 0.513 1 164.893 1.1067 0.2943
Promethion_weight_norm 0 37.292 37.292 1 80.475 80.5037 9.491e-14 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
EE_average_per_hour_norm ~ Category + Promethion_weight_norm + (1 | Batch)
options(contrasts=c("contr.sum", "contr.poly"))
model_ee.2<-(lmer(EE_average_per_hour ~ Category*Sex + Promethion_weight + (1 | Batch), Promethion_activity_ee.2))
stats::shapiro.test(resid(model_ee.2))
Shapiro-Wilk normality test
data: resid(model_ee.2)
W = 0.98823, p-value = 0.1453
anova(lm(residuals(model_ee.2)~fitted.values(model_ee.2)))
Analysis of Variance Table
Response: residuals(model_ee.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_ee.2) 1 0.000246 0.00024649 0.3533 0.553
Residuals 176 0.122793 0.00069769
Promethion_activity_ee.2_M <- Promethion_activity_ee.2 %>% dplyr::filter(Sex =="M")
Promethion_activity_ee.2_F <- Promethion_activity_ee.2 %>% dplyr::filter(Sex =="F")
model_ee.M<-(lmer(EE_average_per_hour ~ Category + Promethion_weight + (1 | Batch), Promethion_activity_ee.2_M))
model_ee.F<-(lmer(EE_average_per_hour ~ Category + Promethion_weight + (1 | Batch), Promethion_activity_ee.2_F))
shapiro.test(residuals(model_ee.M))
Shapiro-Wilk normality test
data: residuals(model_ee.M)
W = 0.9812, p-value = 0.2378
shapiro.test(residuals(model_ee.F))
Shapiro-Wilk normality test
data: residuals(model_ee.F)
W = 0.98739, p-value = 0.5334
aov(lm(residuals(model_ee.M)~fitted.values(model_ee.M)))
Call:
aov(formula = lm(residuals(model_ee.M) ~ fitted.values(model_ee.M)))
Terms:
fitted.values(model_ee.M) Residuals
Sum of Squares 0.00021583 0.06038527
Deg. of Freedom 1 85
Residual standard error: 0.02665361
Estimated effects may be unbalanced
aov(lm(residuals(model_ee.F)~fitted.values(model_ee.F)))
Call:
aov(formula = lm(residuals(model_ee.F) ~ fitted.values(model_ee.F)))
Terms:
fitted.values(model_ee.F) Residuals
Sum of Squares 0.00014060 0.06272214
Deg. of Freedom 1 89
Residual standard error: 0.026547
Estimated effects may be unbalanced
car::Anova(model_ee.M, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: EE_average_per_hour
F Df Df.res Pr(>F)
Category 0.1824 1 79.391 0.6705
Promethion_weight 31.1667 1 72.787 3.847e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_ee.F, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: EE_average_per_hour
F Df Df.res Pr(>F)
Category 3.5387 1 83.064 0.06346 .
Promethion_weight 31.5606 1 87.220 2.271e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
effects::effect("Category", mod = model_ee.M, se =TRUE) %>% as.data.frame()
effects::effect("Category", mod = model_ee.F, se =TRUE) %>% as.data.frame()
model_ee_residuals_M <-(lmer(EE_average_per_hour ~ Promethion_weight + (1 | Batch) , Promethion_activity_ee.2_M))
Promethion_activity_ee.2_M$EE_average_per_hour_residual <- residuals(model_ee_residuals_M)/sigma(model_ee_residuals_M)
model_ee_residuals_F <-(lmer(EE_average_per_hour ~ Promethion_weight + (1 | Batch) , Promethion_activity_ee.2_F))
Promethion_activity_ee.2_F$EE_average_per_hour_residual <- residuals(model_ee_residuals_F)/sigma(model_ee_residuals_F)
Promethion_activity_ee.2_MF <- rbind(Promethion_activity_ee.2_M, Promethion_activity_ee.2_F)
Fig2_ee_resid <- Promethion_activity_ee.2_MF %>%
ggplot(aes(x = Category, y = EE_average_per_hour_residual, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. energy expenditure") +
facet_wrap(.~Sex, scales = "free_y", ncol =1) +
theme(strip.background = element_blank(),
strip.text = element_blank()) +
theme(axis.title.x=element_blank()) +
theme(axis.text.x = element_text(face = "italic"))
Fig2_ee_resid
# Resting metabolic rate (RMR) for each cycle
Circadian_RMR_all <- Circadian.2 %>%
dplyr::arrange(StartDate_common, desc(Cycle)) %>%
dplyr::group_by(MouseID) %>%
dplyr::summarise(All_RMR =mean(QR_EE_30)) %>%
#dplyr::filter(Day == 3 & Cycle == 0) %>%
dplyr::select(MouseID, All_RMR)%>%
dplyr::ungroup()
Circadian_RMR_dark <- Circadian.2 %>%
dplyr::filter(Cycle == 0) %>% # 0 = dark cycle = activity period of mice (nocturnal)
dplyr::arrange(StartDate_common, desc(Cycle)) %>%
dplyr::group_by(MouseID) %>%
dplyr::summarise(Dark_RMR =mean(QR_EE_30))%>%
#dplyr::filter(Day == 3) %>%
dplyr::select(MouseID, Dark_RMR)%>%
dplyr::ungroup()
Circadian_RMR_light <- Circadian.2 %>%
dplyr::filter(Cycle == 1) %>% # 1 = light cycle = resting period of mice (nocturnal)
dplyr::arrange(StartDate_common, desc(Cycle)) %>%
dplyr::group_by(MouseID) %>%
dplyr::summarise(Light_RMR =mean(QR_EE_30)) %>%
#dplyr::filter(Day == 3) %>%
dplyr::select(MouseID, Light_RMR)%>%
dplyr::ungroup()
Circadian_RMR <- Circadian_RMR_all %>%
dplyr::left_join(Circadian_RMR_dark, by ="MouseID") %>%
dplyr::left_join(Circadian_RMR_light, by ="MouseID") %>%
dplyr::left_join(metadata, by =c("MouseID")) %>%
tidyr::drop_na(Promethion_weight)
set.seed(612)
options(contrasts=c("contr.sum", "contr.poly"))
Circadian_RMR$All_RMR_norm<- predict(bestNormalize::log_x(Circadian_RMR$All_RMR))
Circadian_RMR$Dark_RMR_norm<- predict(bestNormalize::log_x(Circadian_RMR$Dark_RMR))
Circadian_RMR$Light_RMR_norm<- predict(bestNormalize::log_x(Circadian_RMR$Light_RMR))
Circadian_RMR$Promethion_weight_norm<- predict(bestNormalize(Circadian_RMR$Promethion_weight))
Circadian_RMR_M <- Circadian_RMR %>% dplyr::filter(Sex == "M")
Circadian_RMR_F <- Circadian_RMR %>% dplyr::filter(Sex == "F")
model_rmr_all_m<-(lmer(All_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch/Promethion_Cabinet), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rmr_dark_m<-(lmer(Dark_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch/Promethion_Cabinet), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rmr_light_m<-(lmer(Light_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch/Promethion_Cabinet), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rmr_all_f<-(lmer(All_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch/Promethion_Cabinet), Circadian_RMR_F))
boundary (singular) fit: see help('isSingular')
model_rmr_dark_f<-(lmer(Dark_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch/Promethion_Cabinet), Circadian_RMR_F))
boundary (singular) fit: see help('isSingular')
model_rmr_light_f<-(lmer(Light_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch/Promethion_Cabinet), Circadian_RMR_F))
boundary (singular) fit: see help('isSingular')
step(model_rmr_all_m)
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 -114.98 241.96
(1 | Batch) 1 5 -114.98 239.96 0.00000 1 1.0000
(1 | Promethion_Cabinet:Batch) 2 4 -115.14 238.28 0.32139 1 0.5708
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Category 1 1 0.7969 66.433 -19.465 1.0199 0.31545
Promethion_weight_norm 0 1 3.2012 69.634 -17.371 4.0959 0.04613 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
All_RMR_norm ~ Promethion_weight_norm
step(model_rmr_dark_m)
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 -117.97 247.94
(1 | Batch) 1 5 -117.97 245.94 0.00000 1 1.0000
(1 | Promethion_Cabinet:Batch) 2 4 -118.20 244.40 0.45317 1 0.5008
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Promethion_weight_norm 1 1 0.69057 71.280 -13.339 0.8218 0.3673
Category 2 1 1.08876 72.369 -14.020 1.2983 0.2577
Model found:
Dark_RMR_norm ~ 1
step(model_rmr_light_m)
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 -123.35 258.7
(1 | Promethion_Cabinet:Batch) 1 5 -123.35 256.7 0 1 1
(1 | Batch) 2 4 -123.35 254.7 0 1 1
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Category 1 1 0.0673 79.867 -3.4425 0.0709 0.79075
Promethion_weight_norm 0 1 5.7019 85.569 0.5569 6.0683 0.01578 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Light_RMR_norm ~ Promethion_weight_norm
step(model_rmr_all_f)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 -125.61 263.22
(1 | Promethion_Cabinet:Batch) 1 5 -125.61 261.22 0.000 1 1
(1 | Batch) 0 4 -133.39 274.79 15.562 1 7.982e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category 1 0.1508 0.1508 1 83.050 0.1911 0.66318
Promethion_weight_norm 0 4.0853 4.0853 1 87.906 5.2239 0.02468 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
All_RMR_norm ~ Promethion_weight_norm + (1 | Batch)
step(model_rmr_dark_f)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 -124.33 260.65
(1 | Promethion_Cabinet:Batch) 1 5 -124.33 258.65 0.000 1 1
(1 | Batch) 0 4 -133.52 275.03 18.382 1 1.807e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category 1 1.1493 1.1493 1 83.039 1.5101 0.2226
Promethion_weight_norm 2 1.9050 1.9050 1 88.546 2.4892 0.1182
Model found:
Dark_RMR_norm ~ (1 | Batch)
step(model_rmr_light_f)
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 6 -123.38 258.77
(1 | Promethion_Cabinet:Batch) 1 5 -123.38 256.77 0.00000 1 1.0000
(1 | Batch) 2 4 -123.47 254.94 0.17612 1 0.6747
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Category 0 1 9.0518 82.852 -4.5356 10.793 0.001464 **
Promethion_weight_norm 0 1 8.6658 82.466 -4.9605 10.333 0.001827 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Light_RMR_norm ~ Category + Promethion_weight_norm
set.seed(149)
options(contrasts=c("contr.sum", "contr.poly"))
model_rmr_all_m2<-(lmer(All_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rmr_dark_m2<-(lmer(Dark_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rmr_light_m2<-(lmer(Light_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rmr_all_f2<-(lmer(All_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
model_rmr_dark_f2<-(lmer(Dark_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
model_rmr_light_f2<-(lmer(Light_RMR_norm ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
shapiro.test(residuals(model_rmr_all_m2))
Shapiro-Wilk normality test
data: residuals(model_rmr_all_m2)
W = 0.97402, p-value = 0.07705
shapiro.test(residuals(model_rmr_dark_m2))
Shapiro-Wilk normality test
data: residuals(model_rmr_dark_m2)
W = 0.98664, p-value = 0.5151
shapiro.test(residuals(model_rmr_light_m2))
Shapiro-Wilk normality test
data: residuals(model_rmr_light_m2)
W = 0.97793, p-value = 0.1431
anova(lm(residuals(model_rmr_all_m2) ~ fitted.values(model_rmr_all_m2)))
Analysis of Variance Table
Response: residuals(model_rmr_all_m2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_rmr_all_m2) 1 0.000 0.00000 0 1
Residuals 85 65.636 0.77219
anova(lm(residuals(model_rmr_dark_m2) ~ fitted.values(model_rmr_dark_m2)))
Analysis of Variance Table
Response: residuals(model_rmr_dark_m2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_rmr_dark_m2) 1 0.000 0.00000 0 1
Residuals 85 70.589 0.83046
anova(lm(residuals(model_rmr_light_m2) ~ fitted.values(model_rmr_light_m2)))
Analysis of Variance Table
Response: residuals(model_rmr_light_m2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_rmr_light_m2) 1 0.0 0.00000 0 1
Residuals 85 79.8 0.93882
shapiro.test(residuals(model_rmr_all_f2))
Shapiro-Wilk normality test
data: residuals(model_rmr_all_f2)
W = 0.98488, p-value = 0.376
shapiro.test(residuals(model_rmr_dark_f2))
Shapiro-Wilk normality test
data: residuals(model_rmr_dark_f2)
W = 0.98758, p-value = 0.5468
shapiro.test(residuals(model_rmr_light_f2))
Shapiro-Wilk normality test
data: residuals(model_rmr_light_f2)
W = 0.99356, p-value = 0.9414
anova(lm(residuals(model_rmr_all_f2) ~ fitted.values(model_rmr_all_f2)))
Analysis of Variance Table
Response: residuals(model_rmr_all_f2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_rmr_all_f2) 1 0.326 0.32643 0.4416 0.5081
Residuals 89 65.789 0.73921
anova(lm(residuals(model_rmr_dark_f2) ~ fitted.values(model_rmr_dark_f2)))
Analysis of Variance Table
Response: residuals(model_rmr_dark_f2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_rmr_dark_f2) 1 0.318 0.31796 0.4467 0.5057
Residuals 89 63.357 0.71187
anova(lm(residuals(model_rmr_light_f2) ~ fitted.values(model_rmr_light_f2)))
Analysis of Variance Table
Response: residuals(model_rmr_light_f2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_rmr_light_f2) 1 0.047 0.04747 0.059 0.8087
Residuals 89 71.638 0.80492
plot(model_rmr_all_m2)
plot(model_rmr_dark_m2)
plot(model_rmr_light_m2)
plot(model_rmr_all_f2)
plot(model_rmr_dark_f2)
plot(model_rmr_light_f2)
options(contrasts=c("contr.sum", "contr.poly"))
results_model_rmr_all_m <- car::Anova(model_rmr_all_m2, test.statistic ="F", type ="II") %>%
as.data.frame() %>%
tibble::rownames_to_column(var = "model_term") %>%
dplyr::mutate(Circ = "All",
Sex = "M")
results_model_rmr_dark_m <- car::Anova(model_rmr_dark_m2, test.statistic ="F", type ="II") %>%
as.data.frame() %>%
tibble::rownames_to_column(var = "model_term") %>%
dplyr::mutate(Circ = "Dark",
Sex = "M")
results_model_rmr_light_m<-car::Anova(model_rmr_light_m2, test.statistic ="F", type ="II") %>%
as.data.frame() %>%
tibble::rownames_to_column(var = "model_term") %>%
dplyr::mutate(Circ = "Light",
Sex = "M")
results_model_rmr_all_f <- car::Anova(model_rmr_all_f2, test.statistic ="F", type ="II") %>%
as.data.frame() %>%
tibble::rownames_to_column(var = "model_term") %>%
dplyr::mutate(Circ = "All",
Sex = "F")
results_model_rmr_dark_f <- car::Anova(model_rmr_dark_f2, test.statistic ="F", type ="II") %>%
as.data.frame() %>%
tibble::rownames_to_column(var = "model_term") %>%
dplyr::mutate(Circ = "Dark",
Sex = "F")
results_model_rmr_light_f <-car::Anova(model_rmr_light_f2, test.statistic ="F", type ="II") %>%
as.data.frame() %>%
tibble::rownames_to_column(var = "model_term") %>%
dplyr::mutate(Circ = "Light",
Sex = "F")
rbind(results_model_rmr_all_m, results_model_rmr_dark_m, results_model_rmr_light_m,
results_model_rmr_all_f, results_model_rmr_dark_f, results_model_rmr_light_f) %>%
dplyr::filter(model_term == "Category")
model_rest_all.rmr_meff<-(lmer(All_RMR ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rest_dark.rmr_meff<-(lmer(Dark_RMR ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
model_rest_light.rmr_meff<-(lmer(Light_RMR ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rest_all.rmr_feff<-(lmer(All_RMR ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
model_rest_dark.rmr_feff<-(lmer(Dark_RMR ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
model_rest_light.rmr_feff<-(lmer(Light_RMR ~ Category+ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
eff_RMR_all_m<- effects::effect("Category", model_rest_all.rmr_meff, se = TRUE) %>% as.data.frame %>% dplyr::mutate(Circ ="All", Sex ="M")
eff_RMR_dark_m<- effects::effect("Category", model_rest_dark.rmr_meff, se = TRUE) %>% as.data.frame %>% dplyr::mutate(Circ ="dark", Sex ="M")
eff_RMR_light_m<- effects::effect("Category", model_rest_light.rmr_meff, se = TRUE) %>% as.data.frame %>% dplyr::mutate(Circ ="light", Sex ="M")
eff_RMR_all_f<- effects::effect("Category", model_rest_all.rmr_feff, se = TRUE) %>% as.data.frame %>% dplyr::mutate(Circ ="All", Sex ="F")
eff_RMR_dark_f<- effects::effect("Category", model_rest_dark.rmr_feff, se = TRUE) %>% as.data.frame %>% dplyr::mutate(Circ ="dark", Sex ="F")
eff_RMR_light_f<- effects::effect("Category", model_rest_light.rmr_feff, se = TRUE) %>% as.data.frame %>% dplyr::mutate(Circ ="light", Sex ="F")
rbind(eff_RMR_all_m, eff_RMR_dark_m, eff_RMR_light_m, eff_RMR_all_f, eff_RMR_dark_f, eff_RMR_light_f) %>% dplyr::select(Sex, Category, Circ, fit, se)
model_rest_all.rmr_m_resid<-(lmer(All_RMR_norm ~ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rest_dark.rmr_m_resid<-(lmer(Dark_RMR_norm ~ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
model_rest_light.rmr_m_resid<-(lmer(Light_RMR_norm ~ Promethion_weight_norm + (1 |Batch), Circadian_RMR_M))
boundary (singular) fit: see help('isSingular')
model_rest_all.rmr_f_resid<-(lmer(All_RMR_norm ~ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
model_rest_dark.rmr_f_resid<-(lmer(Dark_RMR_norm ~ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
model_rest_light.rmr_f_resid<-(lmer(Light_RMR_norm ~ Promethion_weight_norm + (1 |Batch), Circadian_RMR_F))
Circadian_RMR_M2 <- Circadian_RMR_M %>%
dplyr::mutate(all_rmr_resid = residuals(model_rest_all.rmr_m_resid)/sigma(model_rest_all.rmr_m_resid),
dark_rmr_resid = residuals(model_rest_dark.rmr_m_resid)/sigma(model_rest_dark.rmr_m_resid),
light_rmr_resid = residuals(model_rest_light.rmr_m_resid)/sigma(model_rest_light.rmr_m_resid))
Circadian_RMR_F2 <- Circadian_RMR_F %>%
dplyr::mutate(all_rmr_resid = residuals(model_rest_all.rmr_f_resid)/sigma(model_rest_all.rmr_f_resid),
dark_rmr_resid = residuals(model_rest_dark.rmr_f_resid)/sigma(model_rest_dark.rmr_f_resid),
light_rmr_resid = residuals(model_rest_light.rmr_f_resid)/sigma(model_rest_light.rmr_f_resid))
Circadian_rmr_resid <- rbind(Circadian_RMR_M2, Circadian_RMR_F2) %>%
dplyr::select(MouseID, dark_rmr_resid, light_rmr_resid, all_rmr_resid) %>%
dplyr::rename(Dark = dark_rmr_resid, Light = light_rmr_resid, All = all_rmr_resid) %>%
tidyr::gather(Circ, mean_resting_metabolic_rate_residuals, Dark:All) %>%
dplyr::left_join(metadata, by = c("MouseID"))
Fig2_rmr_dark_light <- Circadian_rmr_resid %>%
dplyr::filter(Circ != "All") %>%
ggplot(aes(x = Category, y = mean_resting_metabolic_rate_residuals, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(Sex~Circ) +
theme(#strip.background = element_blank(),
strip.text.y = element_blank()) +
labs(y="Adj. resting metabolic rate")
Fig2_rmr_dark_light
FigS3_rmr_all <- Circadian_rmr_resid %>%
dplyr::filter(Circ == "All") %>%
ggplot(aes(x = Category, y = mean_resting_metabolic_rate_residuals, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(.~Sex) +
theme(strip.background = element_blank(),
strip.text = element_blank()) +
labs(y="Adj. resting metabolic rate")
FigS3_rmr_all
Fig2_legend <- cowplot::get_legend(metadata_Cmin %>%
dplyr::mutate(Sex = ifelse(Sex == "F", "Female", "Male"),
Category = ifelse(Category == "Killed", "Killed-CM", "Live-CM"),
Sex_Category = paste(Sex, Category, sep = " ")) %>%
ggplot(aes(x = Category, y = qPCR_Cmin_per_gCC, shape = Sex_Category, color = Sex_Category)) +
geom_point(aes(shape = Sex_Category, color= Sex_Category), alpha =0.7, size =0.5, show.legend = T) +
scale_shape_manual(values=c(16, 16,4, 4)) +
scale_color_manual(values=c(color_Category, color_Category)) +
theme_classic(base_size = 10) +
guides(shape = guide_legend(override.aes = list(size = 3, alpha = 1))) +
theme(legend.title=element_blank()) +
theme(legend.position = "bottom"))
Fig2_align_1 <- cowplot::align_plots(Fig2_beam_breaks + theme(legend.position="none"),
Fig2_bb_cmin + theme(legend.position="none"),
Fig2_bb_fe + theme(legend.position="none"),
Fig2_distance + theme(legend.position="none"),
Fig2_distance_cmin + theme(legend.position="none"),
Fig2_fe_distance + theme(legend.position="none"),
align = 'hv', axis = 'tblr')
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
Fig2_align_2 <- cowplot::align_plots(Fig2_ee_weight + theme(legend.position="none"),
Fig2_ee_resid + theme(legend.position="none"),
Fig2_rmr_dark_light + theme(legend.position="none"),
align = 'hv', axis = 'tblr')
`geom_smooth()` using formula 'y ~ x'
Warning: Removed 6 rows containing non-finite values (stat_smooth).Warning: Removed 6 rows containing missing values (geom_point).
Fig2_1 <- cowplot::plot_grid(NA,
Fig2_align_1[[1]],
Fig2_align_1[[2]],
Fig2_align_1[[3]],
NA,
Fig2_align_1[[4]],
Fig2_align_1[[5]],
Fig2_align_1[[6]],
ncol=4, nrow=2, labels = c(NA,"A", "C", "E", NA, "B", "D", "F"), label_size = 12, rel_widths = c(0.3, 1, 1.5, 1.5), rel_heights = c(1.2, 2))
Warning: Cannot convert object of class logical into a grob.Warning: Cannot convert object of class logical into a grob.
Fig2_2 <- cowplot::plot_grid(NA,
Fig2_align_2[[1]],
Fig2_align_2[[2]],
Fig2_align_2[[3]],
ncol=4, nrow=1, labels = c(NA, "G", "H", "I"),label_size = 12, rel_widths = c(0.3, 1.2, 1, 1.8))
Warning: Cannot convert object of class logical into a grob.
Figure2 <- cowplot::plot_grid(Fig2_1,
Fig2_2,
Fig2_legend,
ncol=1, nrow=3, rel_heights = c(3.2, 2, 0.3))
Warning: Removed 1 rows containing missing values (geom_text).Warning: Removed 1 rows containing missing values (geom_text).Warning: Removed 1 rows containing missing values (geom_text).
Figure2
ggsave("./Figure2.pdf", plot = Figure2, device = cairo_pdf,
width = 17,
height = 19,
units = "cm")
Figure S3: Mouse voluntary activity and average resting metabolic rate
FigS3_align <- cowplot::align_plots(FigS3_speed + theme(legend.position="none"),
FigS3_rmr_all + theme(legend.position="none"),
align = 'hv', axis = 'tblr')
FigS3_1 <- cowplot::plot_grid(FigS3_align[[1]],
FigS3_align[[2]],
ncol=2, nrow=1, labels = c("A", "B"), label_size = 12, rel_widths = c(0.9, 1.5))
FigS3 <- cowplot::plot_grid(FigS3_1,
Fig2_legend,
ncol=1, nrow=2, rel_heights = c(1, 0.1 ))
FigS3
ggsave("./FigS3.pdf", plot = FigS3, device = cairo_pdf,
width = 9,
height = 7.5,
units = "cm")
Fig3_qPCR_bacteria <- metadata_Cmin %>%
dplyr::mutate(SQ_per_gCC_e10 = qPCR_16S_SQ_per_gCC/10^10) %>%
ggplot(aes(x = Category, y = SQ_per_gCC_e10, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = expression(paste("Microbes (GE/g) x", e^10))) +
theme(axis.text.x = element_text(face = "italic"))
Fig3_qPCR_bacteria
set.seed(759)
metadata_Cmin <- metadata_Cmin %>%
dplyr::mutate(qPCR_16S_SQ_per_gCC = as.numeric(qPCR_16S_SQ_per_gCC),
qPCR_16S_SQ_per_gCC_norm = predict(bestNormalize(qPCR_16S_SQ_per_gCC)))
options(contrasts=c("contr.sum", "contr.poly"))
model_biomass<- lmerTest::lmer(qPCR_16S_SQ_per_gCC_norm ~ Category*Sex + T6_weight + Plate + (1|qPCR_Round/Batch/Sex), data = metadata_Cmin)
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 2 negative eigenvaluesWarning: Model failed to converge with 2 negative eigenvalues: -1.4e-08 -1.1e-03
lmerTest::step(model_biomass, keep = "Category")
Warning: Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?Warning: Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -8.1e-04Warning: Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 11 -251.44 524.89
(1 | Sex:(Batch:qPCR_Round)) 1 10 -251.44 522.89 0.0000 1 1.00000
(1 | qPCR_Round) 2 9 -251.44 520.89 0.0000 1 1.00000
(1 | Batch:qPCR_Round) 0 8 -253.30 522.60 3.7152 1 0.05392 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Category:Sex 1 0.0785 0.0785 1 166.180 0.0945 0.75893
T6_weight 2 0.3091 0.3091 1 171.758 0.3742 0.54151
Sex 3 1.1350 1.1350 1 9.694 1.3783 0.26842
Category 0 5.3811 5.3811 1 168.188 6.5377 0.01145 *
Plate 0 8.2627 4.1314 2 19.773 5.0193 0.01726 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
qPCR_16S_SQ_per_gCC_norm ~ Category + Plate + (1 | Batch:qPCR_Round)
model_biomass.2<- lmer(qPCR_16S_SQ_per_gCC_norm ~ Category + Plate + (1 | Batch:qPCR_Round), data = metadata_Cmin)
shapiro.test(residuals(model_biomass.2))
Shapiro-Wilk normality test
data: residuals(model_biomass.2)
W = 0.9801, p-value = 0.01094
anova(lm(residuals(model_biomass.2) ~ fitted(model_biomass.2))) # test for heteroscedasticity
Analysis of Variance Table
Response: residuals(model_biomass.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted(model_biomass.2) 1 0.764 0.76419 0.9759 0.3245
Residuals 179 140.169 0.78307
plot(model_biomass.2)
car::Anova(model_biomass.2, type = "II", test.statistic ="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: qPCR_16S_SQ_per_gCC_norm
F Df Df.res Pr(>F)
Category 6.5313 1 167.738 0.01149 *
Plate 4.8712 2 24.506 0.01655 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_biomass.eff<- lmer(qPCR_16S_SQ_per_gCC~ Category + Plate + (1 | Batch:qPCR_Round), data = metadata_Cmin)
Warning: Model may not have converged with 1 eigenvalue close to zero: 1.8e-17
effects::effect("Category", model_biomass.eff, se =TRUE) %>% as.data.frame
Fig3_Cmin_biomass<- metadata_Cmin %>%
ggplot(aes(x= qPCR_Cmin_per_gCC_norm ,y=qPCR_16S_SQ_per_gCC_norm)) +
geom_smooth(method = "lm", se = F, alpha = 0.5, size = 0.5, color ="black")+
geom_point(aes(shape = Sex, color =Category), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
theme_classic(base_size = 10) +
stat_cor(method = "spearman", cor.coef.name = c("rho"), size = 3) +
labs(y = "Norm. Microbes", x = "Norm. C. minuta")
Fig3_Cmin_biomass
# Unrarefied OTUs
reads_unrare <- Bracken_otu_table_reads %>%
dplyr::select(OTU_ID, contains("CC"), # select only cecal content samples
-taxonomy, -contains(Metagenomics_exclude_id)) %>%
dplyr::rename(rowname = "OTU_ID") %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value) %>%
tibble::column_to_rownames(var = "var")
names(reads_unrare) <- properColnames(reads_unrare)
# Rarefied OTUs
set.seed(2)
reads_rare = reads_unrare %>%
GUniFrac::Rarefy(460000)
reads_rare = reads_rare$otu.tab.rff %>%
as.data.frame()
reads_rare_norm <- reads_rare %>%
tibble::rownames_to_column(var = "rowname") %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value) %>%
dplyr::rename(OTU_ID = var)
reads_rare_norm[,2:183] <- as.data.table(lapply(reads_rare_norm[,2:183], as.numeric))
reads_rare_norm <- reads_rare_norm %>%
dplyr::rename(rowname = OTU_ID) %>%
dplyr::mutate_if(is.numeric,function(x) (x/sum(x))) %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value) %>%
dplyr::rename(sampleid = var) %>%
dplyr::left_join(Metagenomics_metadata_CC, by ="sampleid") %>%
dplyr::left_join(metadata, by ="MouseID") %>%
dplyr::left_join(qPCR_data, by ="MouseID") %>%
dplyr::mutate(qPCR_16S_SQ_per_gCC = as.numeric(qPCR_16S_SQ_per_gCC)) %>%
dplyr::group_by(sampleid) %>%
dplyr::mutate_each(funs(.*qPCR_16S_SQ_per_gCC), starts_with("s__"))
write.table(reads_rare_norm, file = "./data/Interim_output/reads_rare_norm.txt",row.names=FALSE,sep="\t", quote = FALSE)
reads_rare_norm<- fread("./data/Interim_output/reads_rare_norm.txt")
Taxonomy <- Bracken_otu_table_reads %>%
dplyr::select(OTU_ID, taxonomy) %>%
dplyr::mutate(var = OTU_ID)
Taxonomy$var <-properNames(Taxonomy$var)
Taxonomy$OTU_ID <- gsub(" ", "_", Taxonomy$OTU_ID)
reads_rare_norm_metadata <- reads_rare_norm %>%
tibble::column_to_rownames(var = "sampleid") %>%
dplyr::select(-contains("s__"))
reads_rare_norm_reads <- reads_rare_norm %>%
dplyr::select(sampleid, contains("s__")) %>%
tidyr::gather(var, value, -sampleid) %>%
tidyr::spread(sampleid, value) %>%
dplyr::mutate_if(is.numeric, round) %>%
tibble::column_to_rownames(var = "var")
# Separate taxonomy
tax_levels = c("Domain", "Phylum", "Class", "Order", "Family", "Genus", "Species")
# Also note that the unclassified reads do not count for the total seq count!
MF_bracken <- reads_rare_norm_reads %>%
tibble::rownames_to_column(var = "var") %>%
dplyr::mutate_at(c(2:183), as.numeric) %>%
dplyr::left_join(Taxonomy, by ="var") %>%
dplyr::rename(name = var) %>%
dplyr::filter(name != "Unclassified") %>%
tidyr::separate(taxonomy, into = tax_levels, sep = ";")
# Total counts for relative abundance
Total_counts = MF_bracken %>%
dplyr::select_if(is.numeric) %>%
dplyr::summarise_all(sum)
# summarize genus
Taxa_df = MF_bracken %>%
dplyr::group_by(Genus) %>%
dplyr::summarise_if(is.numeric, sum) %>%
dplyr::ungroup() %>%
dplyr::rename("Taxon" = "Genus")
# Bind tables and transform to relative abundance
Taxa_df_raw = Taxa_df %>%
dplyr::rowwise() %>%
dplyr::mutate(mean_abund = mean(c_across(where(is.numeric))))
# Filter taxa with mean abund < 0.5
Taxa_vec = Taxa_df_raw %>%
dplyr::filter(mean_abund >= 100000000) %>%
dplyr::pull(Taxon)
# Create df of abundant taxa
Abundant_df = Taxa_df_raw %>%
dplyr::filter(Taxon %in% Taxa_vec)
# Collapse rare taxa into 'other'
Rare_df = Taxa_df_raw %>%
ungroup() %>%
dplyr::filter(!(Taxon %in% Taxa_vec)) %>%
dplyr::summarise_if(is.numeric, sum) %>%
dplyr::mutate(Taxon = "Other") %>%
dplyr::select(Taxon, everything())
# Join and melt
Taxa_df.2 = bind_rows(Abundant_df, Rare_df) %>%
dplyr::select(-mean_abund) %>%
tidyr::pivot_longer(cols = -Taxon, names_to = "Sample", values_to = "Abundance")
metadata_taxa_barplot <- metadata %>%
dplyr::select(MouseID, Category, Batch) %>%
dplyr::group_by(Category, Batch) %>%
dplyr::mutate(Mouse_nr_Category_Batch = row_number()) %>%
dplyr::ungroup() %>%
dplyr::select(MouseID, Mouse_nr_Category_Batch)
Taxa_barplot <- reads_rare_norm_metadata %>%
tibble::rownames_to_column(var = "Sample") %>%
dplyr::left_join(Taxa_df.2, by = "Sample") %>%
dplyr::left_join(metadata_taxa_barplot, by = "MouseID") %>%
dplyr::mutate(Abundance = as.numeric(Abundance))
taxabarplot_levels <- reads_rare_norm_metadata %>%
dplyr::arrange(Category, -qPCR_16S_SQ_per_gCC) %>%
dplyr::pull(MouseID)
FigS4_Taxa_barplot<- Taxa_barplot %>%
dplyr::mutate(Abundance = as.numeric(Abundance)) %>%
tidyr::separate(Taxon, into =c(NA, "Taxon"), sep= "__") %>%
dplyr::mutate(Taxon = replace_na(Taxon, "Other")) %>%
dplyr::mutate(Taxon = factor(Taxon, levels = c("Alistipes", "Bacteroides", "COE1", "Eisenbergiella","Enterocloster", "Flavonifractor", "Parabacteroides", "Phocaeicola", "Ruthenibacterium", "Tolumonas", "Other"))) %>%
dplyr::mutate(Abundance_10x10 = Abundance/10^10) %>%
dplyr::mutate(Category2 = ifelse(Category == "Killed", "Killed-CM", "Live-CM")) %>%
ggplot(aes(x=factor(MouseID, levels = taxabarplot_levels), y=Abundance_10x10, fill=Taxon)) +
geom_bar(stat="identity") +
theme_classic(base_size = 10) +
scale_fill_manual(values = c("#000000", "#b6dbff","#920000", "#009292", "#ffb6db", "#ffff6d", "#db6d00", "#006ddb", "#24ff24", "#ff6db6", "#004949"),
name = "Genus") +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank()) +
coord_cartesian(clip = "off") +
theme(legend.position="right", legend.key.size=unit(0.4, "cm"),
legend.text=element_text(face = "italic")) +
ggh4x::facet_grid2(Sex~Category2, scales = "free_x", independent = "x") +
guides(fill=guide_legend(title.position = "top")) +
labs(y= expression(paste("Microbes (GE/g) x", e^10)), x ="Mice") +
theme(strip.background.y = element_blank(),
strip.text.y = element_blank())
Warning: Expected 2 pieces. Missing pieces filled with `NA` in 182 rows [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, ...].
FigS4_Taxa_barplot
gc()
# prepare file
qiime2_reads_rare_norm<- reads_rare_norm %>%
dplyr::select(sampleid, contains("s__")) %>%
dplyr::rename(rowname = sampleid) %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value) %>%
dplyr::group_by(var) %>%
dplyr::mutate(sum_abubnd = sum(c_across(where(is.numeric)))) %>%
dplyr::filter(sum_abubnd > 0) %>%
dplyr::select(-sum_abubnd) %>%
dplyr::ungroup() %>%
dplyr::left_join(Taxonomy, by ="var") %>%
dplyr::select(contains("OTU"), contains("CC"), taxonomy) %>%
dplyr::rename("#OTU ID" = OTU_ID)
gc()
#save output
write.table(qiime2_reads_rare_norm, file = "./data/Interim_output/qiime2_reads_rare_norm.txt", sep = "\t" , row.names = FALSE, quote = FALSE)
source activate /ebio/abt3_projects/Christensenella_CM20/envs/qiime2 #path to qiime2-2022.2 environment
##qiime import data
biom convert -i ./data/Interim_output/qiime2_reads_rare_norm.txt \
-o ./data/Interim_output/qiime2_reads_rare_norm.biom \
--to-hdf5 --process-obs-metadata taxonomy \
--table-type "OTU table"
qiime tools import \
--input-path ./data/Interim_output/qiime2_reads_rare_norm.biom \
--output-path ./data/Interim_output/qiime2_reads_rare_norm.qza \
--type 'FeatureTable[Frequency]' \
--input-format BIOMV210Format
##run diversity
qiime diversity alpha \
--p-metric observed_features \
--i-table ./data/Interim_output/qiime2_reads_rare_norm.qza \
--o-alpha-diversity ./data/Interim_output/alpha_observed_features.qza
qiime diversity alpha \
--p-metric shannon \
--i-table ./data/Interim_output/qiime2_reads_rare_norm.qza \
--o-alpha-diversity ./data/Interim_output/alpha_shannon.qza
qiime diversity alpha \
--p-metric pielou_e \
--i-table ./data/Interim_output/qiime2_reads_rare_norm.qza \
--o-alpha-diversity ./data/Interim_output/alpha_pielou.qza
qiime diversity alpha-phylogenetic \
--p-metric faith_pd \
--i-table ./data/Interim_output/qiime2_reads_rare_norm.qza \
--i-phylogeny ./data/Metagenomics/rooted_tree.qza \
--o-alpha-diversity ./data/Interim_output/alpha_faithPD.qza
qiime diversity beta-phylogenetic \
--p-metric weighted_unifrac \
--i-table ./data/Interim_output/qiime2_reads_rare_norm.qza \
--i-phylogeny ./data/Metagenomics/rooted_tree.qza \
--o-distance-matrix ./data/Interim_output/beta_wUF.qza
qiime diversity beta-phylogenetic \
--p-metric unweighted_unifrac \
--i-table ./data/Interim_output/qiime2_reads_rare_norm.qza \
--i-phylogeny ./data/Metagenomics/rooted_tree.qza \
--o-distance-matrix ./data/Interim_output/beta_uwUF.qza
##export data
qiime tools export \
--input-path ./data/Interim_output/alpha_observed_features.qza \
--output-path ./data/Interim_output/alpha_observed_features
qiime tools export \
--input-path ./data/Interim_output/alpha_shannon.qza \
--output-path ./data/Interim_output/alpha_shannon
qiime tools export \
--input-path ./data/Interim_output/alpha_pielou.qza \
--output-path ./data/Interim_output/alpha_pielou
qiime tools export \
--input-path ./data/Interim_output/alpha_faithPD.qza \
--output-path ./data/Interim_output/alpha_faithPD
qiime tools export \
--input-path ./data/Interim_output/beta_wUF.qza \
--output-path ./data/Interim_output/beta_wUF
qiime tools export \
--input-path ./data/Interim_output/beta_uwUF.qza \
--output-path ./data/Interim_output/beta_uwUF
Alpha_FPD <- fread("./data/Interim_output/alpha_faithPD/alpha-diversity.tsv") %>%
dplyr::rename(sampleid = "#SampleID")
Alpha_observedF <- fread("./data/Interim_output/alpha_observed_features/alpha-diversity.tsv") %>%
dplyr::rename(sampleid = "V1")
Alpha_S <- fread("./data/Interim_output/alpha_shannon/alpha-diversity.tsv") %>%
dplyr::rename(sampleid = "V1")
Alpha_P <- fread("./data/Interim_output/alpha_pielou/alpha-diversity.tsv") %>%
dplyr::rename(sampleid = "V1")
Alpha_div <- Alpha_FPD %>%
dplyr::left_join(Alpha_observedF, by = "sampleid") %>%
dplyr::left_join(Alpha_S, by = "sampleid") %>%
dplyr::left_join(Alpha_P, by = "sampleid") %>%
dplyr::left_join(Metagenomics_metadata_CC, by = "sampleid") %>%
dplyr::filter(!grepl(paste(Metagenomics_exclude_id, collapse="|"), sampleid)) %>%
dplyr::left_join(metadata, by = "MouseID")
Fig3_SE <- Alpha_div %>%
ggplot(aes(x = Category, y = shannon_entropy, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(legend.position="right") +
labs(y = "Shannon Entropy") +
theme(axis.text.x = element_text(face = "italic")) +
theme(axis.title.x=element_blank())+
facet_grid(.~Sex)
Fig3_SE
Fig3_OF <- Alpha_div %>%
ggplot(aes(x = Category, y = observed_features, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(legend.position="right") +
labs(y = "# microbial species") +
theme(axis.text.x = element_text(face = "italic")) +
theme(axis.title.x=element_blank())+
facet_grid(.~Sex)
Fig3_OF
FigS4_FDP <- Alpha_div %>%
ggplot(aes(x = Category, y = faith_pd, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(legend.position="right") +
labs(y = "Faith's PD") +
theme(axis.text.x = element_text(face = "italic")) +
theme(axis.title.x=element_blank()) +
facet_grid(.~Sex)
FigS4_FDP
FigS4_PE <- Alpha_div %>%
ggplot(aes(x = Category, y = pielou_evenness, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(legend.position="right") +
labs(y = "Pilou evenness") +
theme(axis.text.x = element_text(face = "italic")) +
theme(axis.title.x=element_blank())+
facet_grid(.~Sex)
FigS4_PE
wilcox.test due to problems with normality
options(backup_options)
Alpha_div_M <- Alpha_div %>%
dplyr::filter(Sex =="M")
Alpha_div_F <- Alpha_div %>%
dplyr::filter(Sex =="F")
print("se M")
[1] "se M"
wilcox.test(shannon_entropy~Category, data = Alpha_div_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: shannon_entropy by Category
W = 1341, p-value = 0.003972
alternative hypothesis: true location shift is not equal to 0
print("se F")
[1] "se F"
wilcox.test(shannon_entropy~Category, data = Alpha_div_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: shannon_entropy by Category
W = 1191, p-value = 0.398
alternative hypothesis: true location shift is not equal to 0
print("pe M")
[1] "pe M"
wilcox.test(pielou_evenness~Category, data = Alpha_div_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: pielou_evenness by Category
W = 1143, p-value = 0.2093
alternative hypothesis: true location shift is not equal to 0
print("pe F")
[1] "pe F"
wilcox.test(pielou_evenness~Category, data = Alpha_div_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: pielou_evenness by Category
W = 1231, p-value = 0.2491
alternative hypothesis: true location shift is not equal to 0
print("fpd M")
[1] "fpd M"
wilcox.test(faith_pd~Category, data = Alpha_div_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: faith_pd by Category
W = 1260, p-value = 0.02672
alternative hypothesis: true location shift is not equal to 0
print("fpd F")
[1] "fpd F"
wilcox.test(faith_pd~Category, data = Alpha_div_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: faith_pd by Category
W = 1147, p-value = 0.612
alternative hypothesis: true location shift is not equal to 0
print("of M")
[1] "of M"
wilcox.test(observed_features~Category, data = Alpha_div_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: observed_features by Category
W = 1293, p-value = 0.0129
alternative hypothesis: true location shift is not equal to 0
print("of F")
[1] "of F"
wilcox.test(observed_features~Category, data = Alpha_div_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: observed_features by Category
W = 1122.5, p-value = 0.7498
alternative hypothesis: true location shift is not equal to 0
standard_error <- function(x) sd(x) / sqrt(length(x))
mean_se_treat_M <- Alpha_div_M %>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(shannon_entropy), se = standard_error(shannon_entropy))%>%
dplyr::mutate(alpha = "se")
mean_pe_treat_M <- Alpha_div_M %>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(pielou_evenness), se = standard_error(pielou_evenness))%>%
dplyr::mutate(alpha = "pe")
mean_fdp_treat_M <- Alpha_div_M%>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(faith_pd), se = standard_error(faith_pd))%>%
dplyr::mutate(alpha = "fdp")
mean_of_treat_M <- Alpha_div_M %>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(observed_features), se = standard_error(observed_features)) %>%
dplyr::mutate(alpha = "of")
rbind(mean_se_treat_M, mean_pe_treat_M, mean_fdp_treat_M, mean_of_treat_M)
mean_se_treat_F <- Alpha_div_F %>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(shannon_entropy), se = standard_error(shannon_entropy))%>%
dplyr::mutate(alpha = "se")
mean_pe_treat_F <- Alpha_div_F %>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(pielou_evenness), se = standard_error(pielou_evenness))%>%
dplyr::mutate(alpha = "pe")
mean_fdp_treat_F<- Alpha_div_F%>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(faith_pd), se = standard_error(faith_pd))%>%
dplyr::mutate(alpha = "fdp")
mean_of_treat_F <- Alpha_div_F %>%
dplyr::group_by(Category) %>%
dplyr::summarise(mean = mean(observed_features), se = standard_error(observed_features)) %>%
dplyr::mutate(alpha = "of")
rbind(mean_se_treat_F, mean_pe_treat_F, mean_fdp_treat_F, mean_of_treat_F)
Beta_wUF <- fread("./data/Interim_output/beta_wUF/distance-matrix.tsv")
Beta_uwUF <- fread("./data/Interim_output/beta_uwUF/distance-matrix.tsv")
Beta_wUF.2 <- Beta_wUF %>%
dplyr::filter(!grepl(paste(Metagenomics_exclude_id, collapse="|"), V1)) %>%
dplyr::select(-contains(Metagenomics_exclude_id)) %>%
dplyr::arrange(V1) %>%
dplyr::select(order(colnames(.))) %>%
tibble::column_to_rownames(var = "V1")
Beta_uwUF.2 <- Beta_uwUF %>%
dplyr::filter(!grepl(paste(Metagenomics_exclude_id, collapse="|"), V1)) %>%
dplyr::select(-contains(Metagenomics_exclude_id)) %>%
dplyr::arrange(V1) %>%
dplyr::select(order(colnames(.))) %>%
tibble::column_to_rownames(var = "V1")
reads_rare_norm_metadata <- reads_rare_norm_metadata[ order(row.names(reads_rare_norm_metadata)), ]
reads_rare_norm_metadata.melt <- reads_rare_norm_metadata %>%
tibble::rownames_to_column(var = "sampleid") %>%
dplyr::select(sampleid, Category, Sex) %>%
mutate_if(is.factor,as.character)
wUF_melt <- melt(as.matrix(Beta_wUF.2)) %>%
filter(as.character(Var1) != as.character(Var2)) %>%
mutate_if(is.factor,as.character)
uwUF_melt <- melt(as.matrix(Beta_uwUF.2)) %>%
filter(as.character(Var1) != as.character(Var2)) %>%
mutate_if(is.factor,as.character)
colnames(reads_rare_norm_metadata.melt) = c("Var1", "Category1", "Sex1")
wUF_melt = left_join(wUF_melt, reads_rare_norm_metadata.melt, by = "Var1")
uwUF_melt = left_join(uwUF_melt, reads_rare_norm_metadata.melt, by = "Var1")
colnames(reads_rare_norm_metadata.melt) = c("Var2", "Category2", "Sex2")
wUF_melt = left_join(wUF_melt, reads_rare_norm_metadata.melt, by = "Var2")
uwUF_melt = left_join(uwUF_melt, reads_rare_norm_metadata.melt, by = "Var2")
set.seed(765)
wUF_melt.2 <- wUF_melt %>%
dplyr::filter(Category1 == Category2, Sex1 == Sex2) %>%
dplyr::mutate(Category = Category1, Sex = Sex1)
# Issue cant use linaer models --> no normality in residuals
# I will use wilcoxen rank sum test
wUF_melt_M<- wUF_melt.2 %>%
dplyr::filter(Sex =="M")
wUF_melt_F<- wUF_melt.2 %>%
dplyr::filter(Sex =="F")
print("wUF M")
[1] "wUF M"
wilcox.test(value ~ Category, data = wUF_melt_M, exact = FALSE, correct = FALSE)
Wilcoxon rank sum test
data: value by Category
W = 2395224, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
print("wUF F")
[1] "wUF F"
wilcox.test(value ~ Category, data = wUF_melt_F, exact = FALSE, correct = FALSE)
Wilcoxon rank sum test
data: value by Category
W = 2216996, p-value = 0.6028
alternative hypothesis: true location shift is not equal to 0
uwUF_melt.2 <- uwUF_melt %>%
dplyr::filter(Category1 == Category2, Sex1 == Sex2) %>%
dplyr::mutate(Category = Category1, Sex = Sex1)
# Issue cant use linaer models --> no normality in residuals
# I will use wilcoxen rank sum test
uwUF_melt_M<- uwUF_melt.2 %>%
dplyr::filter(Sex =="M")
uwUF_melt_F<- uwUF_melt.2 %>%
dplyr::filter(Sex =="F")
print("uwUF M")
[1] "uwUF M"
wilcox.test(value ~ Category, data = uwUF_melt_M, exact = FALSE, correct = FALSE)
Wilcoxon rank sum test
data: value by Category
W = 2534932, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
print("uwUF F")
[1] "uwUF F"
wilcox.test(value ~ Category, data = uwUF_melt_F, exact = FALSE, correct = FALSE)
Wilcoxon rank sum test
data: value by Category
W = 2395228, p-value = 7.325e-05
alternative hypothesis: true location shift is not equal to 0
Fig3_wUF <- wUF_melt.2 %>%
ggplot(aes(x = Category, y = value, fill=factor(Category))) +
theme_classic(base_size = 10) +
geom_boxplot(alpha =0.7, outlier.size = 0.3, outlier.alpha = 0.5) +
#facet_grid(~ Sex, scales = "free") +
scale_fill_manual(values=color_Category )+
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
labs(y = "weighted\nUniFrac distances") +
theme(axis.text.x = element_text(face = "italic"), axis.title.x=element_blank())+
facet_grid(.~Sex)
Fig3_wUF
Fig3_uwUF <-uwUF_melt.2 %>%
ggplot(aes(x = Category, y = value, fill=factor(Category))) +
theme_classic(base_size = 10) +
geom_boxplot(alpha =0.7, outlier.size = 0.3, outlier.alpha = 0.5) +
#facet_grid(~ Sex, scales = "free") +
scale_fill_manual(values=color_Category )+
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
labs(y = "unweighted\nUniFrac distances") +
theme(axis.text.x = element_text(face = "italic"), axis.title.x=element_blank())+
facet_grid(.~Sex)
Fig3_uwUF
gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 18538619 990.1 41356865 2208.7 41356865 2208.7
Vcells 119645453 912.9 222647753 1698.7 222647753 1698.7
# median abundance C. minuta = 0.000101087 -> 0.01%
thresh_median <- 0.00001 #threshold median abundance (= median abundance C. minuta / 10)
reads_rare.2 <- reads_rare %>%
tibble::rownames_to_column(var = "rowname") %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value)
reads_rare.2[,2:183] <- as.data.table(lapply(reads_rare.2[,2:183], as.numeric))
reads_rare_F<-reads_rare.2 %>%
dplyr::select(var, contains("fB")) %>%
dplyr::rename(rowname = var) %>%
dplyr::mutate_if(is.numeric,function(x) (x/sum(x))) %>%
dplyr::rowwise() %>%
dplyr::mutate(median_abund = median(c_across(where(is.numeric)))) %>%
dplyr::filter(median_abund >= thresh_median) %>%
dplyr::select(-median_abund) %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value) %>%
dplyr::rename(sampleid = var) %>%
dplyr::left_join(Metagenomics_metadata_CC, by ="sampleid") %>%
dplyr::left_join(metadata, by ="MouseID") %>%
dplyr::left_join(qPCR_data, by ="MouseID") %>%
dplyr::mutate(qPCR_16S_SQ_per_gCC = as.numeric(qPCR_16S_SQ_per_gCC)) %>%
dplyr::group_by(sampleid) %>%
dplyr::mutate_each(funs(.*qPCR_16S_SQ_per_gCC), starts_with("s__")) %>%
dplyr::ungroup()
Maaslin_metadata_F <- reads_rare_F %>%
dplyr::select(-contains("s__")) %>%
tibble::column_to_rownames(var = "sampleid")
Maaslin_reads_F <- reads_rare_F %>%
dplyr::select(sampleid, contains("s__")) %>%
tidyr::gather(var, value, -sampleid) %>%
tidyr::spread(sampleid, value) %>%
dplyr::mutate_if(is.numeric, round) %>%
tibble::column_to_rownames(var = "var")
reads_rare_M<-reads_rare.2 %>%
dplyr::select(var, contains("mB")) %>%
dplyr::rename(rowname = var) %>%
dplyr::mutate_if(is.numeric,function(x) (x/sum(x))) %>%
dplyr::rowwise() %>%
dplyr::mutate(median_abund = median(c_across(where(is.numeric)))) %>%
dplyr::filter(median_abund >= thresh_median) %>%
dplyr::select(-median_abund) %>%
tidyr::gather(var, value, -rowname) %>%
tidyr::spread(rowname, value) %>%
dplyr::rename(sampleid = var) %>%
dplyr::left_join(Metagenomics_metadata_CC, by ="sampleid") %>%
dplyr::left_join(metadata, by ="MouseID") %>%
dplyr::left_join(qPCR_data, by ="MouseID") %>%
dplyr::mutate(qPCR_16S_SQ_per_gCC = as.numeric(qPCR_16S_SQ_per_gCC)) %>%
dplyr::group_by(sampleid) %>%
dplyr::mutate_each(funs(.*qPCR_16S_SQ_per_gCC), starts_with("s__")) %>%
dplyr::ungroup()
Maaslin_metadata_M <- reads_rare_M %>%
dplyr::select(-contains("s__")) %>%
tibble::column_to_rownames(var = "sampleid")
Maaslin_reads_M <- reads_rare_M %>%
dplyr::select(sampleid, contains("s__")) %>%
tidyr::gather(var, value, -sampleid) %>%
tidyr::spread(sampleid, value) %>%
dplyr::mutate_if(is.numeric, round) %>%
tibble::column_to_rownames(var = "var")
gc()
options(backup_options)
CM20_Maaslin_species_F_treat = Maaslin2(
input_data = Maaslin_reads_F,
input_metadata = Maaslin_metadata_F,
output = "./data/Interim_output/Maaslin_species_F_treat",
fixed_effects = c("Category", "Run"),
random_effects = c("Batch"),
reference= c("Run,R1-Hiseq"),
min_prevalence = 0.5,
max_significance = 0.1,
plot_scatter = FALSE,
plot_heatmap = FALSE)
CM20_Maaslin_species_M_treat = Maaslin2(
input_data = Maaslin_reads_M,
input_metadata = Maaslin_metadata_M,
output = "./data/Interim_output/Maaslin_species_M_treat",
fixed_effects = c("Category", "Run"),
random_effects = c("Batch"),
reference= c("Run,R1-Hiseq"),
min_prevalence = 0.5,
max_significance = 0.1,
plot_scatter = FALSE,
plot_heatmap = FALSE)
Results_MaasLin_F <- fread("./data/Interim_output/Maaslin_species_F_treat/all_results.tsv") %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(qval = p.adjust(pval, method = "BH")) %>%
dplyr::arrange(qval) %>%
dplyr::mutate(analysis = "F")
Results_MaasLin_M <- fread("./data/Interim_output/Maaslin_species_M_treat/all_results.tsv") %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(qval = p.adjust(pval, method = "BH")) %>%
dplyr::arrange(qval) %>%
dplyr::mutate(analysis = "M")
sig_species_treat_F <- Results_MaasLin_F %>%
dplyr::filter(qval <= 0.1 & abs(coef) >= 1) %>%
pull(feature)
sig_species_treat_M <- Results_MaasLin_M %>%
dplyr::filter(qval <= 0.1 & abs(coef) >= 1) %>%
pull(feature)
sig_species_treat_combined <- unique(c(sig_species_treat_F, sig_species_treat_M))
Results_MaasLin_Category_species_combined <- rbind(Results_MaasLin_F, Results_MaasLin_M) %>%
dplyr::filter(grepl(paste(sig_species_treat_combined, collapse="|"), feature)) %>%
dplyr::rename(var = feature) %>%
dplyr::mutate(var = properNames(var)) %>%
dplyr::left_join(Taxonomy, by ="var") %>%
tidyr::separate(taxonomy, into = tax_levels, sep =";") %>%
dplyr::select(-var, -OTU_ID) %>%
dplyr::mutate(Species = sub("s__", "", Species)) %>%
dplyr::mutate(Family = sub("f__", "", Family)) %>%
dplyr::mutate(stars = cut(qval, breaks=c(-Inf, 0.001, 0.01, 0.1, Inf), label=c("***", "**", "*", "")) )
Fig3_Maaslin.1<- Results_MaasLin_Category_species_combined %>%
arrange(desc(Family), desc(Species)) %>%
mutate(Species = fct_inorder(factor(Species))) %>%
ggplot(aes(x=analysis, y=Species, fill=coef), show.legend = T) +
geom_tile() +
scale_fill_gradient2(low="#D7191C", mid="white", high="#2C7BB6") +
geom_text(aes(label=stars), color = "black", size=3) +
labs(y=NULL, x=NULL, fill="coef") +
theme_classic(base_size = 10) +
theme(legend.position = 'top')+
theme(axis.text.y = element_text(face = "italic")) +
theme(legend.key.height = unit(0.4, 'cm'), legend.key.width = unit(0.4, 'cm')) +
scale_y_discrete(position = "right")
Fig3_Maaslin.2 <- Results_MaasLin_Category_species_combined %>%
arrange(desc(Family), desc(Species)) %>%
mutate(Species = fct_inorder(factor(Species))) %>%
ggplot(aes(y=Species, x=0.1, fill = Family)) +
scale_fill_manual(values = tableau_color_pal('Tableau 20')(19)) +
geom_tile() +
theme_void(base_size = 10) +
theme(legend.position = 'none')
Fig3_Maaslin.legend <- cowplot::get_legend(Results_MaasLin_Category_species_combined %>%
arrange(desc(Family), desc(Species)) %>%
mutate(Species = fct_inorder(factor(Species))) %>%
ggplot(aes(y=Species, x=0.1, fill = Family)) +
scale_fill_manual(values = tableau_color_pal('Tableau 20')(19)) +
geom_tile() +
theme_classic(base_size = 10) +
theme(legend.position = 'left') +
guides(fill=guide_legend(nrow=9, title.position="top")) +
theme(legend.key.size = unit(0.4, 'cm'),
legend.text=element_text(face = "italic")) +
guides(fill=guide_legend(nrow=5,byrow=TRUE)))
Fig3_Maaslin <- Fig3_Maaslin.2 + Fig3_Maaslin.1 + plot_layout(widths = c(0.3, 1))
Fig3_Maaslin
Fig3_legend_treatment_sex <- cowplot::get_legend(metadata_Cmin %>%
dplyr::mutate(Sex = ifelse(Sex == "F", "Female", "Male"),
Category = ifelse(Category == "Killed", "Killed-CM", "Live-CM"),
Sex_Category = paste(Sex, Category, sep = " ")) %>%
ggplot(aes(x = Category, y = qPCR_Cmin_per_gCC, shape = Sex_Category, color = Sex_Category)) +
geom_point(aes(shape = Sex_Category, color= Sex_Category), alpha =0.7, size =0.5, show.legend = T) +
scale_shape_manual(values=c(16, 16,4, 4)) +
scale_color_manual(values=c(color_Category, color_Category)) +
theme_classic(base_size = 10) +
theme(legend.title=element_blank()) +
guides(shape=guide_legend(nrow=2, byrow=TRUE,
override.aes = list(size = 3, alpha = 1))))
Fig3_align <- cowplot::align_plots(Fig3_qPCR_bacteria + theme(legend.position="none"),
Fig3_Cmin_biomass + theme(legend.position="none"),
Fig3_OF + theme(legend.position="none"),
Fig3_SE + theme(legend.position="none"),
Fig3_wUF + theme(legend.position="none"),
Fig3_uwUF + theme(legend.position="none"),
align = 'hv', axis = 'rlbt')
`geom_smooth()` using formula 'y ~ x'
Fig3_1 <- cowplot::plot_grid(Fig3_align[[1]],
Fig3_align[[2]],
Fig3_align[[3]],
Fig3_align[[4]],
Fig3_align[[5]],
Fig3_align[[6]],
ncol=2, nrow=3, labels = c( "A", "B", "C", "D", "E", "F"), label_size = 12, rel_widths = c(1, 1), rel_heights = c(1, 1, 1))
Fig3_2 <- cowplot::plot_grid(Fig3_legend_treatment_sex,
Fig3_Maaslin,
Fig3_Maaslin.legend,
ncol=1, nrow=3, labels = c(NA, "G", NA), label_size = 12, rel_heights = c(0.2, 1.5, 0.5))
Figure3 <- cowplot::plot_grid(Fig3_1,
Fig3_2,
ncol=2, nrow=1, rel_widths = c(1.3, 1))
Warning: Removed 1 rows containing missing values (geom_text).Warning: Removed 1 rows containing missing values (geom_text).
Figure3
ggsave("./Figure3.pdf", plot = Figure3, device = cairo_pdf,
width = 17 ,
height = 14,
units = "cm")
FigS4_barplot_legend <- cowplot::get_legend(FigS4_Taxa_barplot + theme(legend.position="bottom") )
FigS4_legend_treatment_sex <- cowplot::get_legend(metadata_Cmin %>%
dplyr::mutate(Sex = ifelse(Sex == "F", "Female", "Male"),
Category = ifelse(Category == "Killed", "Killed-CM", "Live-CM"),
Sex_Category = paste(Sex, Category, sep = " ")) %>%
ggplot(aes(x = Category, y = qPCR_Cmin_per_gCC, shape = Sex_Category, color = Sex_Category)) +
geom_point(aes(shape = Sex_Category, color= Sex_Category), alpha =0.7, size =0.5, show.legend = T) +
scale_shape_manual(values=c(16, 16,4, 4)) +
scale_color_manual(values=c(color_Category, color_Category)) +
theme_classic(base_size = 10) +
theme(legend.title=element_blank()) +
guides(shape=guide_legend(override.aes = list(size = 3, alpha = 1))) +
theme(legend.position="bottom"))
FigS4_align <- cowplot::align_plots(FigS4_FDP + theme(legend.position="none"),
FigS4_PE + theme(legend.position="none"),
align = 'v', axis = 'l')
FigS4_1 <- cowplot::plot_grid(NA,
FigS4_Taxa_barplot + theme(legend.position="none"),
ncol=2, nrow=1, rel_widths = c(0.1, 2), labels = c( "A", NA), label_size = 12)
Warning: Cannot convert object of class logical into a grob.
FigS4_2 <- cowplot::plot_grid(FigS4_align[[1]],
FigS4_align[[2]],
ncol=2, nrow=1, rel_widths = c(1, 1), labels = c("B","C"), label_size = 12)
FigureS4 <- cowplot::plot_grid(FigS4_1,
FigS4_barplot_legend,
FigS4_2,
FigS4_legend_treatment_sex,
ncol=1, nrow=4, rel_heights = c(1.6, 0.35, 1, 0.2))
Warning: Removed 1 rows containing missing values (geom_text).
FigureS4
ggsave("./FigureS4.pdf", plot = FigureS4, device = cairo_pdf,
width = 10.5,
height = 13,
units = "cm")
GCMS_SCFAs.2<- GCMS_SCFAs %>%
dplyr::left_join(metadata, by = "MouseID")
Fig4_totalSCFA <- GCMS_SCFAs.2 %>%
ggplot(aes(x = Category, y = Total_SCFA, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y= "Total SCFAs (mM/g)") +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(.~Sex) +
theme(strip.background = element_blank(),strip.text = element_blank())
Fig4_totalSCFA
set.seed(501)
GCMS_SCFAs.2$Total_SCFA_norm <- predict(bestNormalize(GCMS_SCFAs.2$Total_SCFA))
options(contrasts=c("contr.sum", "contr.poly"))
model_scfa<- lmer(Total_SCFA_norm ~ Category*Sex + Extraction_round + (Category|Sex/Batch) + (Category|Batch) + (1|Deriv), data = GCMS_SCFAs.2)
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -2.1e-07Warning: Model may not have converged with 1 eigenvalue close to zero: 3.5e-09
step(model_scfa)
boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 2 eigenvalues close to zero: 3.1e-09 -1.4e-09boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -8.6e-04Warning: Model may not have converged with 1 eigenvalue close to zero: -6.8e-09boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 2 eigenvalues close to zero: 3.1e-09 -1.4e-09boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.0e-06Warning: Model may not have converged with 2 eigenvalues close to zero: 8.6e-09 -2.3e-09boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 2 eigenvalues close to zero: 3.1e-09 -1.4e-09boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 1 eigenvalue close to zero: -8.4e-09boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -3.3e-03boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -9.4e-08Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model may not have converged with 1 eigenvalue close to zero: 9.7e-11boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 1 eigenvalue close to zero: -8.4e-09boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 1 eigenvalue close to zero: 8.1e-09boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 1 eigenvalue close to zero: -9.8e-10boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model may not have converged with 1 eigenvalue close to zero: -9.8e-10boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -2.3e-08boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 2 negative eigenvalues: -2.3e-08 -5.7e+01boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 17 -233.52 501.05
Category in (Category | Batch:Sex) 1 15 -233.52 497.05 0.00000 2 1.0000
Category in (Category | Sex) 2 13 -233.52 493.05 0.00000 2 1.0000
(1 | Batch:Sex) 3 12 -233.52 491.05 0.00000 1 1.0000
(1 | Sex) 4 11 -233.52 489.05 0.00000 1 0.9999
Category in (Category | Batch) 5 9 -234.54 487.07 2.02774 2 0.3628
(1 | Batch) 6 8 -234.54 485.07 0.00000 1 1.0000
(1 | Deriv) 7 7 -234.87 483.73 0.65658 1 0.4178
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Extraction_round 0 2 51.800 176.15 1.018 36.867 4.124e-14 ***
Category:Sex 0 1 3.638 127.99 -55.434 5.178 0.02407 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Total_SCFA_norm ~ Category + Sex + Extraction_round + Category:Sex
options(contrasts=c("contr.sum", "contr.poly"))
model_scfa.2<- lm(Total_SCFA_norm ~ Category + Sex + Extraction_round + Category:Sex, data = GCMS_SCFAs.2)
shapiro.test(residuals(model_scfa.2))
Shapiro-Wilk normality test
data: residuals(model_scfa.2)
W = 0.98942, p-value = 0.1924
anova(lm(residuals(model_scfa.2)~fitted.values(model_scfa.2)))
Analysis of Variance Table
Response: residuals(model_scfa.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_scfa.2) 1 0.00 0.00000 0 1
Residuals 181 124.35 0.68701
par(mfrow=c(2,2))
plot(model_scfa.2)
GCMS_SCFAs_M <- GCMS_SCFAs.2 %>% dplyr::filter(Sex =="M")
GCMS_SCFAs_F <- GCMS_SCFAs.2 %>% dplyr::filter(Sex =="F")
model_scfa_m <- lm(Total_SCFA_norm ~ Category + Extraction_round, data = GCMS_SCFAs_M)
model_scfa_f <- lm(Total_SCFA_norm ~ Category + Extraction_round, data = GCMS_SCFAs_F)
shapiro.test(residuals(model_scfa_m))
Shapiro-Wilk normality test
data: residuals(model_scfa_m)
W = 0.98536, p-value = 0.4111
shapiro.test(residuals(model_scfa_f))
Shapiro-Wilk normality test
data: residuals(model_scfa_f)
W = 0.99216, p-value = 0.8629
anova(lm(residuals(model_scfa_m)~fitted.values(model_scfa_m)))
Analysis of Variance Table
Response: residuals(model_scfa_m)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_scfa_m) 1 0.000 0.0000 0 1
Residuals 88 73.013 0.8297
anova(lm(residuals(model_scfa_f)~fitted.values(model_scfa_f)))
Analysis of Variance Table
Response: residuals(model_scfa_f)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_scfa_f) 1 0.000 0.00000 0 1
Residuals 91 49.676 0.54589
car::Anova(model_scfa_m, test.statistic="F", type = "II")
Anova Table (Type II tests)
Response: Total_SCFA_norm
Sum Sq Df F value Pr(>F)
Category 1.989 1 2.3426 0.1296
Extraction_round 19.815 2 11.6696 3.282e-05 ***
Residuals 73.013 86
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_scfa_f, test.statistic="F", type = "II")
Anova Table (Type II tests)
Response: Total_SCFA_norm
Sum Sq Df F value Pr(>F)
Category 1.499 1 2.6851 0.1048
Extraction_round 33.646 2 30.1403 1.011e-10 ***
Residuals 49.676 89
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_scfa_meff <- lm(Total_SCFA ~ Category + Extraction_round, data = GCMS_SCFAs_M)
model_scfa_feff <- lm(Total_SCFA ~ Category + Extraction_round, data = GCMS_SCFAs_F)
effects::effect("Category", model_scfa_meff, se=TRUE) %>% as.data.frame
effects::effect("Category", model_scfa_feff, se=TRUE) %>% as.data.frame
SCFA_F <- GCMS_SCFAs.2 %>%
dplyr::filter(Sex =="F") %>%
dplyr::select(MouseID, Acetate:Caproate, Propionate:Valerate) %>%
tibble::column_to_rownames(var = "MouseID")
SCFA_M <- GCMS_SCFAs.2 %>%
dplyr::filter(Sex =="M") %>%
dplyr::select(MouseID, Acetate:Caproate, Propionate:Valerate) %>%
tibble::column_to_rownames(var = "MouseID")
SCFA_F_meta <- GCMS_SCFAs.2 %>%
dplyr::filter(Sex =="F") %>%
tibble::column_to_rownames(var = "MouseID")
SCFA_M_meta <- GCMS_SCFAs.2 %>%
dplyr::filter(Sex =="M") %>%
tibble::column_to_rownames(var = "MouseID")
options(backup_options)
SCFA_F = Maaslin2(
input_data = SCFA_F,
input_metadata = SCFA_F_meta,
output = "./data/Interim_output/SCFA_F",
fixed_effects = c("Category", "Extraction_round"),
reference = c("Extraction_round,E1"),
random_effects = c("Batch"),
min_prevalence = FALSE,
min_abundance = FALSE,
min_variance = FALSE,
analysis_method = "LM",
max_significance = 0.1)
SCFA_M = Maaslin2(
input_data = SCFA_M,
input_metadata = SCFA_M_meta,
output = "./data/Interim_output/SCFA_M",
fixed_effects = c("Category", "Extraction_round"),
reference = c("Extraction_round,E1"),
random_effects = c("Batch"),
min_prevalence = FALSE,
min_abundance = FALSE,
min_variance = FALSE,
max_significance = 0.1)
SCFA_F_results <- fread("./data/Interim_output/SCFA_F/all_results.tsv")
SCFA_M_results <-fread("./data/Interim_output/SCFA_M/all_results.tsv")
SCFA_F_treat <- SCFA_F_results %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(qval2 = p.adjust(pval, method= "BH")) %>%
dplyr::arrange(qval2)
SCFA_M_treat <-SCFA_M_results %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(qval2 = p.adjust(pval, method= "BH")) %>%
dplyr::arrange(qval2)
SCFA_F_treat
SCFA_M_treat
Fig4_butyrate <- GCMS_SCFAs.2 %>%
ggplot(aes(x = Category, y = Butyrate, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y= "Butyrate (mM/g)") +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(.~Sex) +
theme(strip.background = element_blank(),strip.text = element_blank())
Fig4_butyrate
FigS5_SCFAs <- GCMS_SCFAs.2 %>%
dplyr::mutate(Sex_Category =paste (Sex, Category, sep ="_")) %>%
dplyr::select(Category,Sex_Category, Batch, Sex, Acetate, Propionate, Valerate, Caproate) %>%
tidyr::gather(SCFA, measurement, c(Acetate:Caproate)) %>%
ggplot(aes(x = Category, y = measurement, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "K", "Live" = "L")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Conc. (mM/g)") +
theme(axis.title.x=element_blank()) +
ggh4x::facet_nested_wrap(~ SCFA + Sex, scales ="free_y",ncol =4, labeller=function(x) {x[1]}) +
theme(legend.position="bottom") +
theme(axis.text.x = element_text(face = "italic")) +
theme(strip.background = element_blank())
FigS5_SCFAs
options(contrasts=c("contr.sum", "contr.poly"))
set.seed(193)
SCFA_activity <- Promethion_activity %>%
dplyr::select(MouseID, Distance_traveled, Beam_breaks, Promethion_Cabinet) %>%
dplyr::left_join(GCMS_SCFAs.2, by ="MouseID") %>%
drop_na(Distance_traveled, Total_SCFA) %>%
dplyr::mutate(Distance_traveled_norm = predict(bestNormalize::boxcox(Distance_traveled)),
Beam_breaks_norm = predict(bestNormalize(Beam_breaks)),
Total_SCFA_norm = predict(bestNormalize(Total_SCFA)),
Butyrate_norm = predict(bestNormalize(Butyrate)))
model_scfa_dist <- lmerTest::lmer(Distance_traveled_norm ~ Total_SCFA_norm*Extraction_round*Sex + (1|Batch), data = SCFA_activity)
lmerTest::step(model_scfa_dist)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 14 -228.88 485.76
(1 | Batch) 0 13 -251.14 528.29 44.524 1 2.512e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Total_SCFA_norm:Extraction_round:Sex 1 0.8478 0.4239 2 162.03 0.7677 0.46576
Total_SCFA_norm:Sex 2 0.0004 0.0004 1 164.00 0.0008 0.97749
Extraction_round:Sex 3 1.4297 0.7149 2 165.43 1.3066 0.27352
Total_SCFA_norm:Extraction_round 4 1.8666 0.9333 2 166.98 1.7020 0.18546
Extraction_round 5 0.3233 0.1616 2 169.54 0.2923 0.74694
Total_SCFA_norm 0 4.9167 4.9167 1 170.97 8.9651 0.00316 **
Sex 0 2.9302 2.9302 1 10.07 5.3429 0.04323 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Distance_traveled_norm ~ Total_SCFA_norm + Sex + (1 | Batch)
model_scfa_bb <- lmerTest::lmer(Beam_breaks_norm ~ Total_SCFA_norm*Extraction_round*Sex + (1|Batch), data = SCFA_activity)
lmerTest::step(model_scfa_bb)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 14 -232.45 492.9
(1 | Batch) 0 13 -255.55 537.1 46.201 1 1.067e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Total_SCFA_norm:Extraction_round:Sex 1 0.87087 0.43543 2 161.945 0.7578 0.47033
Total_SCFA_norm:Sex 2 0.22280 0.22280 1 163.949 0.3886 0.53390
Total_SCFA_norm:Extraction_round 3 1.31935 0.65967 2 164.972 1.1550 0.31758
Extraction_round:Sex 4 1.37177 0.68589 2 167.475 1.1965 0.30483
Extraction_round 5 0.02677 0.01339 2 169.548 0.0233 0.97694
Sex 6 2.76604 2.76604 1 10.085 4.8772 0.05148 .
Total_SCFA_norm 0 3.12751 3.12751 1 170.725 5.5135 0.02002 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Beam_breaks_norm ~ Total_SCFA_norm + (1 | Batch)
model_ba_dist <- lmerTest::lmer(Distance_traveled_norm ~ Butyrate_norm*Extraction_round*Sex + (1|Batch), data = SCFA_activity)
lmerTest::step(model_ba_dist)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 14 -232.69 493.39
(1 | Batch) 0 13 -255.23 536.46 45.071 1 1.901e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Butyrate_norm:Extraction_round:Sex 1 0.7659 0.3829 2 162.262 0.6660 0.5152
Butyrate_norm:Extraction_round 2 0.1445 0.0722 2 164.499 0.1262 0.8816
Butyrate_norm:Sex 3 0.2885 0.2885 1 163.142 0.5092 0.4765
Butyrate_norm 4 0.0787 0.0787 1 174.868 0.1392 0.7095
Extraction_round:Sex 5 1.5838 0.7919 2 168.519 1.4065 0.2479
Extraction_round 6 2.5251 1.2626 2 170.321 2.2353 0.1101
Sex 0 3.2516 3.2516 1 10.045 5.6720 0.0384 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Distance_traveled_norm ~ Sex + (1 | Batch)
model_ba_bb<- lmerTest::lmer(Beam_breaks_norm ~ Butyrate_norm*Extraction_round*Sex + (1|Batch), data = SCFA_activity)
lmerTest::step(model_ba_bb)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 14 -233.53 495.07
(1 | Batch) 0 13 -256.59 539.17 46.101 1 1.123e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Butyrate_norm:Extraction_round:Sex 1 0.64013 0.32007 2 162.243 0.5516 0.57708
Butyrate_norm:Sex 2 0.06526 0.06526 1 161.795 0.1130 0.73716
Extraction_round:Sex 3 1.40754 0.70377 2 165.761 1.2243 0.29660
Butyrate_norm:Extraction_round 4 2.55699 1.27849 2 167.457 2.2231 0.11146
Extraction_round 5 0.60806 0.30403 2 170.037 0.5207 0.59507
Butyrate_norm 6 0.56762 0.56762 1 178.554 0.9773 0.32421
Sex 0 3.01315 3.01315 1 10.062 5.1850 0.04586 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Beam_breaks_norm ~ Sex + (1 | Batch)
-> Only total SCFA correlate to activity. Butyrate doesnt.
options(contrasts=c("contr.sum", "contr.poly"))
model_scfa_dis.2 <- lmerTest::lmer(Distance_traveled_norm ~ Total_SCFA_norm + Sex + (1 | Batch), data = SCFA_activity)
shapiro.test(residuals(model_scfa_dis.2))
Shapiro-Wilk normality test
data: residuals(model_scfa_dis.2)
W = 0.99107, p-value = 0.3196
anova(lm(residuals(model_scfa_dis.2)~fitted.values(model_scfa_dis.2)))
Analysis of Variance Table
Response: residuals(model_scfa_dis.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_scfa_dis.2) 1 0.308 0.30791 0.5962 0.441
Residuals 180 92.962 0.51646
model_scfa_bb.2 <- lmerTest::lmer(Beam_breaks_norm ~ Total_SCFA_norm + Sex + (1 | Batch), data = SCFA_activity)
shapiro.test(residuals(model_scfa_bb.2))
Shapiro-Wilk normality test
data: residuals(model_scfa_bb.2)
W = 0.99543, p-value = 0.8563
anova(lm(residuals(model_scfa_bb.2)~fitted.values(model_scfa_bb.2)))
Analysis of Variance Table
Response: residuals(model_scfa_bb.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_scfa_bb.2) 1 0.345 0.34492 0.646 0.4226
Residuals 180 96.106 0.53392
model_ba_dist.2 <- lmerTest::lmer(Distance_traveled_norm ~ Butyrate_norm + Sex + (1 | Batch), data = SCFA_activity)
shapiro.test(residuals(model_ba_dist.2))
Shapiro-Wilk normality test
data: residuals(model_ba_dist.2)
W = 0.99184, p-value = 0.3966
anova(lm(residuals(model_ba_dist.2)~fitted.values(model_ba_dist.2)))
Analysis of Variance Table
Response: residuals(model_ba_dist.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_ba_dist.2) 1 0.351 0.35117 0.6529 0.4201
Residuals 180 96.810 0.53783
model_ba_bb.2 <- lmerTest::lmer(Beam_breaks_norm ~ Butyrate_norm + Sex + (1 | Batch), data = SCFA_activity)
shapiro.test(residuals(model_ba_bb.2))
Shapiro-Wilk normality test
data: residuals(model_ba_bb.2)
W = 0.99259, p-value = 0.4834
anova(lm(residuals(model_ba_bb.2)~fitted.values(model_ba_bb.2)))
Analysis of Variance Table
Response: residuals(model_ba_bb.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_ba_bb.2) 1 0.371 0.37139 0.6792 0.411
Residuals 180 98.427 0.54682
plot(model_scfa_dis.2)
plot(model_scfa_bb.2)
plot(model_ba_dist.2)
plot(model_ba_bb.2)
car::Anova(model_scfa_dis.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Distance_traveled_norm
F Df Df.res Pr(>F)
Total_SCFA_norm 8.9427 1 170.926 0.003197 **
Sex 5.3429 1 10.011 0.043373 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_scfa_bb.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Beam_breaks_norm
F Df Df.res Pr(>F)
Total_SCFA_norm 5.2656 1 170.924 0.02297 *
Sex 4.8772 1 10.011 0.05167 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_ba_dist.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Distance_traveled_norm
F Df Df.res Pr(>F)
Butyrate_norm 1.3875 1 178.519 0.24040
Sex 5.6767 1 9.922 0.03863 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_ba_bb.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Beam_breaks_norm
F Df Df.res Pr(>F)
Butyrate_norm 0.9599 1 178.547 0.32854
Sex 5.2176 1 9.921 0.04566 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
set.seed(763)
r2_model_scfa_dis_mar<- partR2(model_scfa_dis.2, partvars = c("Total_SCFA_norm"), R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_scfa_dis_mar$R2 %>% dplyr::filter(term == "Total_SCFA_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.02828478
r2_model_scfa_bb_mar <- partR2(model_scfa_bb.2, partvars = c("Total_SCFA_norm"), R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_scfa_bb_mar$R2 %>% dplyr::filter(term == "Total_SCFA_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.01728646
r2_model_ba_dist_mar<- partR2(model_ba_dist.2, partvars = c("Butyrate_norm"), R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_ba_dist_mar$R2 %>% dplyr::filter(term == "Butyrate_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.005993161
r2_model_ba_bb_mar<- partR2(model_ba_bb.2, partvars = c("Butyrate_norm"), R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_ba_bb_mar$R2 %>% dplyr::filter(term == "Butyrate_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.004242537
#residuals
model_ba_scfa_dist_resid <- lmerTest::lmer(Distance_traveled_norm ~ Sex + (1 | Batch), data = SCFA_activity)
model_ba_scfa_bb_resid <- lmerTest::lmer(Beam_breaks_norm ~ Sex + (1 | Batch), data = SCFA_activity)
SCFA_activity <- SCFA_activity %>%
dplyr::mutate(Distance_traveled_resid = residuals(model_ba_scfa_dist_resid)/sigma(model_ba_scfa_dist_resid),
Beam_breaks_resid = residuals(model_ba_scfa_bb_resid)/sigma(model_ba_scfa_bb_resid))
Fig4_tscfa_distance <- SCFA_activity %>%
ggplot(aes(x= Total_SCFA_norm ,y=Distance_traveled_resid)) +
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.6, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
theme_classic(base_size = 10) +
labs(y= "Adj. distance traveled", x = "Norm. total SCFAs")
Fig4_tscfa_distance
FigS5_butyrate_beambreaks<- SCFA_activity%>%
ggplot(aes(x= Butyrate_norm ,y=Beam_breaks_resid)) +
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
theme_classic(base_size = 10) +
labs(y= "Adj. beam breaks", x = "Norm. butyrate")
FigS5_butyrate_beambreaks
FigS5_tscfa_beambreaks <- SCFA_activity%>%
ggplot(aes(x= Total_SCFA_norm ,y=Beam_breaks_resid)) +
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.6, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
theme_classic(base_size = 10) +
labs(y= "Adj. beam breaks", x = "Norm. total SCFA")
FigS5_tscfa_beambreaks
Fig4_butyrate_distance <- SCFA_activity %>%
ggplot(aes(x= Butyrate_norm ,y=Distance_traveled_resid)) +
geom_point(aes(shape = Sex, color = Category), alpha =0.7, size =0.6, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_Category, label = c(expression(italic("Killed-CM")), expression(italic("Live-CM"))), name = "Treatment") +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color = "black")+
theme_classic(base_size = 10) +
labs(y= "Adj. distance traveled", x = "Norm. butyrate")
Fig4_butyrate_distance
LCMS_serum.2 <- LCMS_serum %>%
dplyr::filter(Sampletype == "Sample") %>%
dplyr::mutate(GluA_Glu_ratio = Glutamic_acid/Glutamine) %>%
tidyr::separate(sampleid, sep ="_", into = c("Metabolomics_Run", NA, NA), remove = FALSE) %>%
dplyr::left_join(metadata, by ="MouseID")%>%
dplyr::select(-Cortisol) # signal too weak
LCMS_serum.2 %>%
tidyr::gather(molecule, conc_area, Corticosterone:GABA) %>%
dplyr::mutate(Sex_Category = paste(Sex, Category, sep = "_")) %>%
ggplot(aes(x= Sex_Category ,y= conc_area, fill=factor(Category))) +
geom_boxplot(alpha =0.7, outlier.shape = NA) +
scale_fill_manual(values=color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
labs(fill = "Category") +
geom_point(alpha =0.7, size =0.5, position=position_jitterdodge(jitter.width=0.7),
show.legend = T) +
theme_classic(base_size = 11) +
theme(axis.title.x=element_blank()) +
theme(legend.position="bottom") +
scale_y_continuous(labels = function(x) format(x, scientific = TRUE)) +
facet_wrap(molecule~., scales = "free", ncol = 4) +
scale_x_discrete(labels=c("F\nKilled-\nCM", "F\nLive-\nCM", "M\nKilled-\nCM", "M\nLive-\nCM"))
LCMS_serum_F <- LCMS_serum.2 %>%
dplyr::filter(Sex == "F")
LCMS_serum_M <- LCMS_serum.2 %>%
dplyr::filter(Sex == "M")
LCMS_serum_F_metabolites <- LCMS_serum_F %>%
dplyr::select(sampleid, Corticosterone:GABA) %>%
tibble::column_to_rownames(var ="sampleid")
LCMS_serum_M_metabolites <- LCMS_serum_M %>%
dplyr::select(sampleid, Corticosterone:GABA) %>%
tibble::column_to_rownames(var ="sampleid")
LCMS_serum_F_metadata <- LCMS_serum_F %>%
dplyr::select(sampleid, MouseID, Metabolomics_Run, Batch, Category) %>%
tibble::column_to_rownames(var ="sampleid")
LCMS_serum_M_metadata <- LCMS_serum_M %>%
dplyr::select(sampleid, MouseID, Metabolomics_Run, Batch, Category) %>%
tibble::column_to_rownames(var ="sampleid")
options(backup_options)
Maaslin_LCMS_F = Maaslin2(
input_data = LCMS_serum_F_metabolites,
input_metadata = LCMS_serum_F_metadata,
output = "./data/Interim_output/Maaslin_LCMS_F",
fixed_effects = c("Category", "Metabolomics_Run"),
random_effects = c("Batch"),
min_prevalence = 0.7,
max_significance = 0.15)
Maaslin_LCMS_M = Maaslin2(
input_data = LCMS_serum_M_metabolites,
input_metadata = LCMS_serum_M_metadata,
output = "./data/Interim_output/Maaslin_LCMS_M",
fixed_effects = c("Category", "Metabolomics_Run"),
random_effects = c("Batch"),
min_prevalence = 0.7,
max_significance = 0.15)
Maaslin_LCMS_F_results <- fread("./data/Interim_output/Maaslin_LCMS_F/all_results.tsv")
Maaslin_LCMS_M_results <- fread("./data/Interim_output/Maaslin_LCMS_M/all_results.tsv")
Maaslin_LCMS_F_results.2 <- Maaslin_LCMS_F_results %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(qval2 = p.adjust(pval, method = "BH")) %>%
dplyr::arrange(qval2)
Maaslin_LCMS_F_results.2
Maaslin_LCMS_M_results.2 <-Maaslin_LCMS_M_results %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(qval2 = p.adjust(pval, method = "BH")) %>%
dplyr::arrange(qval2)
Maaslin_LCMS_M_results.2
Fig4_Corticosterone <- LCMS_serum.2 %>%
dplyr::mutate(Corticosterone_10x4 = Corticosterone/10000) %>%
ggplot(aes(x = Category, y = Corticosterone_10x4, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "Killed-\nCM", "Live" = "Live-\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y ="Corticosterone\n(PA) x e4") +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(.~Sex , scales ="free") +
theme(strip.background = element_blank(),strip.text = element_blank())
Fig4_Corticosterone
FigS5_LCMS <- LCMS_serum.2 %>%
dplyr::mutate(Sex_Category =paste (Sex, Category, sep ="_")) %>%
dplyr::select(Category, Sex_Category, Batch, Sex, Glutamic_acid, Glutamine, Histamine, Indolelactic_acid, Kynurenine, Thyroxine, Serotonin, Tryptophan, Kynurenic_acid, GABA) %>%
dplyr::rename(Glu = Glutamic_acid, Gln = Glutamine, ILA = Indolelactic_acid, KYN = Kynurenine, T4 = Thyroxine, KYNA = Kynurenic_acid) %>%
tidyr::gather(metabolite, measurement, c(Glu:GABA)) %>%
dplyr::mutate(measurement = as.numeric(measurement)) %>%
dplyr::mutate(measurement_10x4 = measurement/10000) %>%
ggplot(aes(x = Category, y = measurement_10x4, shape = Sex, color = Category)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_Category, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Killed" = "K", "Live" = "L")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = expression(paste("(PA/ml) x ", e^4))) +
theme(axis.title.x=element_blank()) +
ggh4x::facet_nested_wrap(~ metabolite + Sex, scales ="free_y", ncol =10, labeller=function(x) {x[1]}) +
theme(legend.position="bottom") +
theme(axis.text.x = element_text(face = "italic")) +
theme(strip.background = element_blank())
FigS5_LCMS
Maaslin_ee <- Promethion_activity_ee.2_MF %>%
dplyr::select(MouseID, EE_average_per_hour_residual)
Maaslin_metadata <- LCMS_serum.2 %>% dplyr::select(sampleid, MouseID, Category, Sex, Batch, Metabolomics_Run)
xcms_peaklist <- LCMS_xcms_output %>%
dplyr::select(mzmed, rtmed, R3_S11_6456:R3_S9_6438, R1_S13_5916:R1_S9_6189) %>%
dplyr::mutate(Sample = paste(mzmed, rtmed, sep ="/")) %>%
dplyr::select(Sample, R3_S11_6456:R1_S9_6189, -R3_S37_6420)
xcms_metadata <- xcms_peaklist %>%
tidyr::gather(var, value, -Sample) %>%
tidyr::spread(Sample, value) %>%
dplyr::rename(sampleid = var) %>%
dplyr::select(sampleid) %>%
dplyr::left_join(Maaslin_metadata, by ="sampleid") %>%
dplyr::left_join(Maaslin_ee, by ="MouseID") %>%
dplyr::select(sampleid, Category, Sex, Batch, EE_average_per_hour_residual, Metabolomics_Run)
xcms_metadata_F <- xcms_metadata %>%
dplyr::filter(Sex == "F")
xcms_metadata_M <- xcms_metadata %>%
dplyr::filter(Sex == "M")
females <- xcms_metadata_F %>% pull(sampleid)
males <- xcms_metadata_M %>% pull(sampleid)
xcms_peaklist_F <- xcms_peaklist %>%
dplyr::select(Sample, contains(females)) %>%
dplyr::rename(sampleid = Sample)
xcms_peaklist_M <-xcms_peaklist %>%
dplyr::select(Sample, contains(males))%>%
dplyr::rename(sampleid = Sample)
xcms_peaklist_F2 <- xcms_peaklist_F %>%
dplyr::mutate(sampleid = sub('/', '_rt', sampleid)) %>%
dplyr::mutate(sampleid = paste("mz", sampleid, sep = "")) %>%
dplyr::rowwise() %>%
dplyr::mutate(row_mean = mean(R1_S10_6303:R3_S9_6438)) %>% # create a row with mean intensity of peak
dplyr::ungroup() %>%
dplyr::slice_max(row_mean, n = 5000) %>% # select top 5000 peaks according to mean intensity
dplyr::select(-row_mean) %>%
column_to_rownames(var = "sampleid") %>%
dplyr::select(sort(names(.)))
xcms_metadata_F2 <- xcms_metadata_F %>%
dplyr::arrange(sampleid) %>%
column_to_rownames(var = "sampleid")
xcms_peaklist_M2 <- xcms_peaklist_M %>%
dplyr::mutate(sampleid = sub('/', '_rt', sampleid)) %>%
dplyr::mutate(sampleid = paste("mz", sampleid, sep = "")) %>%
dplyr::rowwise() %>%
dplyr::mutate(row_mean = mean(R1_S1_6342:R3_S8_6382)) %>% # create a row with mean intensity of peak
dplyr::ungroup() %>%
dplyr::slice_max(row_mean, n = 5000) %>% # select top 5000 peaks according to mean intensity
dplyr::select(-row_mean) %>%
column_to_rownames(var = "sampleid") %>%
dplyr::select(sort(names(.)))
xcms_metadata_M2 <- xcms_metadata_M %>%
dplyr::arrange(sampleid) %>%
column_to_rownames(var = "sampleid")
options(backup_options)
Xcms_Maaslin_F = Maaslin2(
input_data = xcms_peaklist_F2,
input_metadata = xcms_metadata_F2,
output = "./data/Interim_output/Xcms_Maaslin_F",
fixed_effects = c("Category", "Metabolomics_Run"),
random_effects = c("Batch"),
min_prevalence = 0.7,
max_significance = 0.1,
plot_heatmap = FALSE,
plot_scatter = FALSE)
Xcms_Maaslin_M = Maaslin2(
input_data = xcms_peaklist_M2,
input_metadata = xcms_metadata_M2,
output = "./data/Interim_output/Xcms_Maaslin_M",
fixed_effects = c("Category", "Metabolomics_Run"),
random_effects = c("Batch"),
min_prevalence = 0.7,
max_significance = 0.1,
plot_heatmap = FALSE,
plot_scatter = FALSE)
Xcms_Maaslin_F_EE = Maaslin2(
input_data = xcms_peaklist_F2,
input_metadata = xcms_metadata_F2,
output = "./data/Interim_output/Xcms_Maaslin_F_EE",
fixed_effects = c("EE_average_per_hour_residual", "Metabolomics_Run"),
random_effects = c("Batch"),
min_prevalence = 0.7,
max_significance = 0.1,
plot_heatmap = FALSE,
plot_scatter = FALSE)
Xcms_Maaslin_M_EE = Maaslin2(
input_data = xcms_peaklist_M2,
input_metadata = xcms_metadata_M2,
output = "./data/Interim_output/Xcms_Maaslin_M_EE",
fixed_effects = c("EE_average_per_hour_residual", "Metabolomics_Run"),
random_effects = c("Batch"),
min_prevalence = 0.7,
max_significance = 0.1,
plot_heatmap = FALSE,
plot_scatter = FALSE)
Xcms_Maaslin_F_results<- fread("./data/Interim_output/Xcms_Maaslin_F/all_results.tsv")
Xcms_Maaslin_M_results<- fread("./data/Interim_output/Xcms_Maaslin_M/all_results.tsv")
Xcms_Maaslin_F_EE_results<- fread("./data/Interim_output/Xcms_Maaslin_F_EE/all_results.tsv")
Xcms_Maaslin_M_EE_results<- fread("./data/Interim_output/Xcms_Maaslin_M_EE/all_results.tsv")
#Treatment
Xcms_Maaslin_F_stats <-Xcms_Maaslin_F_results %>%
as.data.frame() %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(t.score = coef/stderr) %>%
tidyr::separate(feature, sep = "_rt", into = c("m.z", "r.t")) %>%
dplyr::mutate(m.z = sub("mz", "", m.z)) %>%
dplyr::mutate(qval2 = p.adjust(pval, method = "BH")) %>%
dplyr::rename(p.value = qval2) %>%
dplyr::arrange(p.value) %>%
dplyr::select(m.z, r.t, p.value, t.score)
Xcms_Maaslin_M_stats <-Xcms_Maaslin_M_results %>%
as.data.frame() %>%
dplyr::filter(metadata == "Category") %>%
dplyr::mutate(t.score = coef/stderr) %>%
tidyr::separate(feature, sep = "_rt", into = c("m.z", "r.t")) %>%
dplyr::mutate(m.z = sub("mz", "", m.z)) %>%
dplyr::mutate(qval2 = p.adjust(pval, method = "BH")) %>%
dplyr::rename(p.value = qval2) %>%
dplyr::arrange(p.value) %>%
dplyr::select(m.z, r.t, p.value, t.score)
#EE
Xcms_Maaslin_F_EE_stats <-Xcms_Maaslin_F_EE_results %>%
as.data.frame() %>%
dplyr::filter(metadata == "EE_average_per_hour_residual") %>%
dplyr::mutate(t.score = coef/stderr) %>%
tidyr::separate(feature, sep = "_rt", into = c("m.z", "r.t")) %>%
dplyr::mutate(m.z = sub("mz", "", m.z)) %>%
dplyr::mutate(qval2 = p.adjust(pval, method = "BH")) %>%
dplyr::rename(p.value = qval2) %>%
dplyr::arrange(p.value) %>%
dplyr::select(m.z, r.t, p.value, t.score)
Xcms_Maaslin_M_EE_stats <-Xcms_Maaslin_M_EE_results %>%
as.data.frame() %>%
dplyr::filter(metadata == "EE_average_per_hour_residual") %>%
dplyr::mutate(t.score = coef/stderr) %>%
tidyr::separate(feature, sep = "_rt", into = c("m.z", "r.t")) %>%
dplyr::mutate(m.z = sub("mz", "", m.z)) %>%
dplyr::mutate(qval2 = p.adjust(pval, method = "BH")) %>%
dplyr::rename(p.value = qval2) %>%
dplyr::arrange(p.value) %>%
dplyr::select(m.z, r.t, p.value, t.score)
write.table(Xcms_Maaslin_F_stats, file = "./data/Interim_output/Xcms_Maaslin_F_stats.txt", sep = "," ,row.names = FALSE, quote = FALSE)
write.table(Xcms_Maaslin_M_stats, file = "./data/Interim_output/Xcms_Maaslin_M_stats.txt", sep = "," ,row.names = FALSE, quote = FALSE)
write.table(Xcms_Maaslin_F_EE_stats, file = "./data/Interim_output/Xcms_Maaslin_F_EE_stats.txt", sep = "," ,row.names = FALSE, quote = FALSE)
write.table(Xcms_Maaslin_M_EE_stats, file = "./data/Interim_output/Xcms_Maaslin_M_EE_stats.txt", sep = "," ,row.names = FALSE, quote = FALSE)
MetaboAnalyst Output
MA_int_F_EE <- fread("./data/Metabolomics/metaboanalyst/MetaboAnalyst_F_EE/mummichog_integ_pathway_enrichment.csv")
MA_gsea_F_EE <- fread("./data/Metabolomics/metaboanalyst/MetaboAnalyst_F_EE/mummichog_fgsea_pathway_enrichment.csv")
#Females
MA_gsea_F_CM.2 <- MA_gsea_F_EE %>%
dplyr::rename(Pathway = V1)%>%
dplyr::select(Pathway, NES)
MA_int_F_EE.2 <- MA_int_F_EE %>%
dplyr::rename(Pathway = V1)%>%
dplyr::select(Pathway, Combined_Pvals) %>%
dplyr::filter(Combined_Pvals <= 0.05) %>%
dplyr::left_join(MA_gsea_F_CM.2, by = "Pathway") %>%
dplyr::arrange(-NES) %>%
dplyr::mutate(analysis = "F")%>%
dplyr::mutate(variable = "EE")
Fig4_F_EE_pathway <- MA_int_F_EE.2 %>%
dplyr::arrange(NES) %>%
dplyr::mutate(Pathway = factor(Pathway, levels = Pathway)) %>%
ggplot(aes(y = NES, x = Pathway, fill = Combined_Pvals)) +
geom_bar(stat = "identity") +
theme_classic(base_size = 10) +
scale_fill_gradient(high = "#fed799", low = "#b73779", na.value = NA, name = "Combined\np-value") +
coord_flip() +
ggtitle("F - EE")+
theme(plot.title = element_text(hjust = 0.5))+
theme(axis.title.y=element_blank()) +
theme(legend.position = 'right') +
theme(
legend.key.height = unit(0.5, 'cm'),
legend.key.width = unit(0.5, 'cm'))
Fig4_F_EE_pathway
Fig4_align <- cowplot::align_plots(Fig4_totalSCFA + theme(legend.position="none"),
Fig4_tscfa_distance + theme(legend.position="none"),
Fig4_butyrate+ theme(legend.position="none"),
Fig4_butyrate_distance + theme(legend.position="none"),
Fig4_Corticosterone+ theme(legend.position="none"),
align = 'v', axis = 'l')
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
Fig4_1 <- cowplot::plot_grid(Fig4_align[[1]],
Fig4_align[[3]],
Fig4_align[[2]],
Fig4_align[[4]],
ncol=4, nrow=1, labels = c("A", "B", "C", "D"),label_size = 12, rel_widths = c(2, 2,1.8, 1.8))
Fig4_2 <- cowplot::plot_grid(Fig4_align[[5]],
Fig4_F_EE_pathway,
Legend_treatment_sex,
ncol=3, nrow=1, labels = c( "E", "F", NA),label_size = 12, rel_widths = c(2, 4.2, 1.4))
Figure4 <- cowplot::plot_grid(NA,
Fig4_1,
Fig4_2,
ncol=1, nrow = 3, rel_heights = c(0.1, 1,1))
Warning: Cannot convert object of class logical into a grob.Warning: Removed 1 rows containing missing values (geom_text).
Figure4
ggsave("./Figure4.pdf", plot = Figure4, device = cairo_pdf,
width = 17,
height = 10.5,
units = "cm")
FigS5_align <- cowplot::align_plots(FigS5_SCFAs + theme(legend.position="none"),
FigS5_tscfa_beambreaks + theme(legend.position="none"),
FigS5_butyrate_beambreaks+ theme(legend.position="none"),
FigS5_LCMS + theme(legend.position="none"),
align = 'v', axis = 'l')
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
FigS5_1 <- cowplot::plot_grid(FigS5_align[[2]],
FigS5_align[[3]],
ncol = 2, nrow=1, labels = c("B", "C"), label_size = 12, rel_widths = c(1,1))
FigS5_2 <- cowplot::plot_grid(FigS5_1,
Fig3_legend_treatment_sex,
ncol = 1, nrow=2, rel_heights = c(1,0.5))
FigS5_3<- cowplot::plot_grid(FigS5_align[[1]],
FigS5_2,
ncol = 2, nrow=1, labels = c("A", NA), label_size = 12, rel_widths = c(1, 1))
FigureS5 <- cowplot::plot_grid(NA,
FigS5_3,
NA,
FigS5_align[[4]],
ncol = 1, nrow=5, labels = c(NA, "A", NA, "D"),label_size = 12, rel_heights = c(0.1,1, 0.1, 1))
Warning: Cannot convert object of class logical into a grob.Warning: Removed 1 rows containing missing values (geom_text).Warning: Cannot convert object of class logical into a grob.
FigureS5
ggsave("./FigureS5.pdf", plot = Fig_supp.met, device = cairo_pdf,
width = 17.3,
height = 18,
units = "cm")
median_Cmin_per_gCC <- median(metadata_Cmin$qPCR_Cmin_SQ_per_gCC)
metadata_Cmin_HL <- metadata_Cmin %>%
dplyr::mutate(Cmin_load = ifelse(qPCR_Cmin_SQ_per_gCC > median_Cmin_per_gCC, "High", "Low")) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels = c("Low", "High")))
FigS6_high_Low <- metadata_Cmin_HL %>%
dplyr::mutate(Cmin_per_gCC_1e7 = qPCR_Cmin_SQ_per_gCC / 1e7) %>%
ggplot(aes(x = Category, y = Cmin_per_gCC_1e7, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Category), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values=color_HL, label = c("Low-CM", "High-CM"),name = "Group") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = expression(paste("C. minuta (GE/g) x ", e^7))) +
theme(axis.text.x = element_text(face = "italic")) +
geom_hline(yintercept=(median_Cmin_per_gCC/ 1e7), linetype="dashed", color = "black") +
scale_x_discrete(labels=c("Killed" = "Killed\nCM", "Live" = "Live\nCM"))
FigS6_high_Low
set.seed(763)
Promethion_Food_HL <- metadata_Cmin_HL %>%
dplyr::select(MouseID, Cmin_load) %>%
dplyr::left_join(Promethion_Food) %>%
tidyr::drop_na(Cmin_load, Promethion_weight_norm)
Joining, by = "MouseID"
Promethion_Food_HL$FI_kcal_day_norm <- predict(bestNormalize(Promethion_Food_HL$FI_kcal_day))
options(contrasts=c("contr.sum", "contr.poly"))
model_food_HL <- lmerTest::lmer(FI_kcal_day_norm ~ Cmin_load*Sex + Sex*Promethion_weight_norm +Promethion_Cabinet + (Cmin_load|Batch/Sex/Promethion_Cabinet), data = Promethion_Food_HL)
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_food_HL, keep = "Cmin_load")
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -1.1e-02boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with max|grad| = 0.00579757 (tol = 0.002, component 1)boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 17 -218.25 470.50
Cmin_load in (Cmin_load | Sex:Batch) 1 15 -218.25 466.50 0.00000 2 1.0000
(1 | Sex:Batch) 2 14 -218.25 464.50 0.00001 1 0.9971
Cmin_load in (Cmin_load | Promethion_Cabinet:(Sex:Batch)) 3 12 -218.38 460.76 0.25714 2 0.8794
(1 | Promethion_Cabinet:(Sex:Batch)) 4 11 -218.38 458.76 0.00000 1 1.0000
Cmin_load in (Cmin_load | Batch) 5 9 -218.59 455.19 0.42441 2 0.8088
(1 | Batch) 6 8 -218.63 453.26 0.07053 1 0.7906
Backward reduced fixed-effect table:
Eliminated Df Sum of Sq RSS AIC F value Pr(>F)
Cmin_load:Sex 1 1 0.1436 117.57 -46.608 0.1957 0.658795
Sex:Promethion_weight_norm 2 1 0.1146 117.69 -48.445 0.1569 0.692559
Promethion_Cabinet 3 1 1.3217 119.01 -48.580 1.8193 0.179277
Cmin_load 0 1 0.1039 119.11 -50.434 0.1423 0.706510
Sex 0 1 8.7229 127.73 -38.767 11.9473 0.000698 ***
Promethion_weight_norm 0 1 3.7749 122.78 -45.365 5.1703 0.024281 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
FI_kcal_day_norm ~ Cmin_load + Sex + Promethion_weight_norm
no effect of Cmin_load
options(contrasts=c("contr.sum", "contr.poly"))
model_food_HL.2 <- lm(FI_kcal_day_norm ~ Cmin_load+Sex + Promethion_weight_norm, data = Promethion_Food_HL)
shapiro.test(residuals(model_food_HL.2))
Shapiro-Wilk normality test
data: residuals(model_food_HL.2)
W = 0.98146, p-value = 0.02484
anova(lm(residuals(model_food_HL.2)~fitted.values(model_food_HL.2)))
Analysis of Variance Table
Response: residuals(model_food_HL.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_food_HL.2) 1 0.00 0.00000 0 1
Residuals 165 119.01 0.72126
car::Anova(model_food_HL.2, test.statistic ="F", type ="II")
Anova Table (Type II tests)
Response: FI_kcal_day_norm
Sum Sq Df F value Pr(>F)
Cmin_load 0.104 1 0.1423 0.706510
Sex 8.723 1 11.9473 0.000698 ***
Promethion_weight_norm 3.775 1 5.1703 0.024281 *
Residuals 119.008 163
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_food_HL.eff <- lm(FI_kcal_day ~ Cmin_load+Sex + Promethion_weight_norm, data = Promethion_Food_HL)
effects::effect("Cmin_load", model_food_HL.eff, se = TRUE) %>% as.data.frame
model_food_HL_resid <- lm(FI_kcal_day_norm ~ Sex + Promethion_weight_norm, data = Promethion_Food_HL)
Promethion_Food_HL$FI_kcal_day_resid_HL <- residuals(model_food_HL_resid)/sigma(model_food_HL_resid)
FigS6_food <- Promethion_Food_HL %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = FI_kcal_day_resid_HL, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL) +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. food intake") +
theme(axis.text.x = element_text(face = "italic"))
FigS6_food
options(contrasts=c("contr.sum", "contr.poly"))
set.seed(650)
Promethion_Food_HL <- Promethion_Food_HL %>%
dplyr::mutate(Feed_eficiency_norm = predict(bestNormalize(Feed_eficiency)))
model_feeding_eff_HL <- lmer(Feed_eficiency_norm ~ Sex*Cmin_load + Promethion_Cabinet + (1|Batch), data = Promethion_Food_HL)
step(model_feeding_eff_HL)
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 7 -225.24 464.48
(1 | Batch) 0 6 -237.92 487.83 25.351 1 4.778e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Promethion_Cabinet 1 0.02893 0.02893 1 151.545 0.0402 0.84130
Sex:Cmin_load 2 0.68520 0.68520 1 162.932 0.9586 0.32898
Sex 3 0.23681 0.23681 1 9.538 0.3338 0.57679
Cmin_load 0 2.99525 2.99525 1 163.922 4.2210 0.04151 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Feed_eficiency_norm ~ Cmin_load + (1 | Batch)
model_feeding_eff_HL.2 <- lmer(Feed_eficiency_norm ~ Cmin_load + (1|Batch), data = Promethion_Food_HL)
shapiro.test(residuals(model_feeding_eff_HL.2))
Shapiro-Wilk normality test
data: residuals(model_feeding_eff_HL.2)
W = 0.99084, p-value = 0.3608
anova(lm(residuals(model_feeding_eff_HL.2)~fitted.values(model_feeding_eff_HL.2)))
Analysis of Variance Table
Response: residuals(model_feeding_eff_HL.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_feeding_eff_HL.2) 1 1.107 1.10725 1.6738 0.1976
Residuals 165 109.152 0.66153
plot(model_feeding_eff_HL.2)
Anova(model_feeding_eff_HL.2, type ="II", test.statistic ="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Feed_eficiency_norm
F Df Df.res Pr(>F)
Cmin_load 4.1482 1 163.97 0.04329 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_feeding_eff_HL.eff <- lmer(Feed_eficiency ~ Cmin_load + (1|Batch), data = Promethion_Food_HL)
effects::effect("Cmin_load", model_feeding_eff_HL.eff, se = TRUE) %>% as.data.frame
model_feeding_eff_HL.resid <- lmer(Feed_eficiency_norm ~ (1|Batch), data = Promethion_Food_HL)
Promethion_Food_HL$Feed_efficency_resid_HL <- residuals(model_feeding_eff_HL.resid)/sigma(model_feeding_eff_HL.resid)
FigS6_feed_eff <- Promethion_Food_HL %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = Feed_efficency_resid_HL, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL) +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. feed efficiency") +
theme(axis.text.x = element_text(face = "italic"))
FigS6_feed_eff
set.seed(628)
metadata_bc_HL <- metadata_Cmin_HL %>%
dplyr::select(MouseID, Cmin_load) %>%
dplyr::left_join(metadata_bc, by ="MouseID") %>%
tidyr::drop_na(Cmin_load, bombcal_Calorific_Value_kcal_total_day)
metadata_bc_HL <- metadata_bc_HL %>%
dplyr::mutate(bombcal_Calorific_Value_kcal_total_day_norm = predict(bestNormalize(bombcal_Calorific_Value_kcal_total_day)),
Promethion_weight_norm <- predict(bestNormalize(Promethion_weight)),
bombcal_Dry_sample_mass_norm <- predict(bestNormalize(bombcal_Dry_sample_mass)))
model_Bomb_cal_HL <- lmerTest::lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ Cmin_load*Sex + Promethion_weight_norm +(Cmin_load|Batch/Sex/Promethion_Cabinet), data = metadata_bc_HL)
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_Bomb_cal_HL, keep = "Cmin_load")
Warning: Model failed to converge with max|grad| = 0.00204632 (tol = 0.002, component 1)boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 2 negative eigenvalues: -2.4e-02 -1.3e-01boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -2.6e-01boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Warning: Model failed to converge with 1 negative eigenvalue: -4.9e-01Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -2.6e-01Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -2.6e-01
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 15 -110.47 250.94
Cmin_load in (Cmin_load | Sex:Batch) 1 13 -110.47 246.94 0.0000 2 1.000000
(1 | Sex:Batch) 2 12 -110.47 244.94 0.0000 1 0.999903
Cmin_load in (Cmin_load | Batch) 3 10 -110.56 241.12 0.1864 2 0.911007
Cmin_load in (Cmin_load | Promethion_Cabinet:(Sex:Batch)) 4 8 -110.63 237.25 0.1298 2 0.937172
(1 | Batch) 5 7 -110.63 235.25 0.0004 1 0.983430
(1 | Promethion_Cabinet:(Sex:Batch)) 0 6 -115.33 242.66 9.4111 1 0.002157 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Cmin_load:Sex 1 0.8972 0.8972 1 82.646 1.5933 0.2104077
Sex 2 0.2487 0.2487 1 19.272 0.4399 0.5150264
Cmin_load 0 2.0141 2.0141 1 83.901 3.5741 0.0621396 .
Promethion_weight_norm 0 8.0426 8.0426 1 56.535 14.2717 0.0003825 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
bombcal_Calorific_Value_kcal_total_day_norm ~ Cmin_load + Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch))
options(contrasts=c("contr.sum", "contr.poly"))
model_Bomb_cal_HL.2 <- lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ Cmin_load + Promethion_weight_norm+ (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_bc_HL)
stats::shapiro.test(residuals(model_Bomb_cal_HL.2))
Shapiro-Wilk normality test
data: residuals(model_Bomb_cal_HL.2)
W = 0.99079, p-value = 0.7991
anova(lm(residuals(model_Bomb_cal_HL.2)~fitted.values(model_Bomb_cal_HL.2)))
Analysis of Variance Table
Response: residuals(model_Bomb_cal_HL.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_Bomb_cal_HL.2) 1 0.529 0.52857 1.0551 0.3072
Residuals 86 43.082 0.50096
plot(model_Bomb_cal_HL.2)
options(contrasts=c("contr.sum", "contr.poly"))
car::Anova(model_Bomb_cal_HL.2, test.statistic="F", type = "II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: bombcal_Calorific_Value_kcal_total_day_norm
F Df Df.res Pr(>F)
Cmin_load 3.4532 1 83.871 0.0666359 .
Promethion_weight_norm 12.9316 1 56.017 0.0006835 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_Bomb_cal_HL_eff <- lmer(bombcal_Calorific_Value_kcal_total_day ~ Cmin_load + Promethion_weight_norm+ (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_bc_HL)
effect(c("Cmin_load"), model_Bomb_cal_HL_eff, se =TRUE) %>% as.data.frame
model_Bomb_cal_HL_resid <- lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ Sex + Promethion_weight_norm+ (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_bc_HL)
metadata_bc_HL$bombcal_Calorific_Value_kcal_total_day_resid_HL <- residuals(model_Bomb_cal_HL_resid)/sigma(model_Bomb_cal_HL_resid)
FigS6_bomb_cal <- metadata_bc_HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = bombcal_Calorific_Value_kcal_total_day_resid_HL, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL) +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. fecal energy content") +
theme(axis.text.x = element_text(face = "italic"))
FigS6_bomb_cal
Beam Breaks
set.seed(259)
Promethion_activity_HL <- metadata_Cmin_HL %>%
dplyr::select(MouseID, Cmin_load) %>%
dplyr::left_join(Promethion_activity, by ="MouseID") %>%
tidyr::drop_na(Cmin_load, Beam_breaks)
Promethion_activity_HL$Beam_breaks_norm <- predict(bestNormalize(Promethion_activity_HL$Beam_breaks))
options(contrasts=c("contr.sum", "contr.poly"))
model_bb_HL<-(lmer(Beam_breaks_norm ~ Cmin_load*Sex + Promethion_Cabinet + (Cmin_load|Batch), Promethion_activity_HL))
step(model_bb_HL, keep ="Cmin_load")
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 9 -221.60 461.19
Cmin_load in (Cmin_load | Batch) 1 7 -222.16 458.31 1.122 2 0.5707
(1 | Batch) 0 6 -238.09 488.17 31.855 1 1.661e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Promethion_Cabinet 1 0.0587 0.0587 1 164.730 0.1023 0.74948
Cmin_load:Sex 2 0.1064 0.1064 1 175.991 0.1865 0.66640
Cmin_load 0 2.0815 2.0815 1 176.694 3.6581 0.05741 .
Sex 0 3.4091 3.4091 1 9.588 5.9913 0.03535 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Beam_breaks_norm ~ Cmin_load + Sex + (1 | Batch)
options(contrasts=c("contr.sum", "contr.poly"))
model_bb_HL.2<-(lmer(Beam_breaks_norm ~ Cmin_load + (1|Batch), Promethion_activity_HL))
stats::shapiro.test(resid(model_bb_HL.2))
Shapiro-Wilk normality test
data: resid(model_bb_HL.2)
W = 0.9904, p-value = 0.2703
anova(lm(residuals(model_bb_HL.2)~fitted.values(model_bb_HL.2)))
Analysis of Variance Table
Response: residuals(model_bb_HL.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_bb_HL.2) 1 0.450 0.45046 0.8434 0.3597
Residuals 178 95.074 0.53412
plot(model_bb_HL.2)
car::Anova(model_bb_HL.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: Beam_breaks_norm
F Df Df.res Pr(>F)
Cmin_load 3.0085 1 175.4 0.08458 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_bb_HL.eff<-(lmer(Beam_breaks ~ Cmin_load + (1|Batch), Promethion_activity_HL))
effects::effect("Cmin_load", model_bb_HL.eff, se =TRUE) %>% as.data.frame()
model_bb_HL.resid<-(lmerTest::lmer(Beam_breaks_norm ~ (1 | Batch), Promethion_activity_HL))
Promethion_activity_HL$BeamBreaks_HL_resid <- residuals(model_bb_HL.resid)/sigma(model_bb_HL.resid)
FigS6_bb_HL <- Promethion_activity_HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = Beam_breaks_norm, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL) +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. beam breaks") +
theme(axis.text.x = element_text(face = "italic"))
FigS6_bb_HL
Distance traveled
set.seed(312)
Promethion_activity_HL$Distance_traveled_norm<- predict(bestNormalize(Promethion_activity_HL$Distance_traveled))
model_distance_HL<-(lmer(Distance_traveled_norm ~ Cmin_load*Sex + Promethion_Cabinet + (Cmin_load|Batch), Promethion_activity_HL))
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_distance_HL, keep = "Cmin_load")
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 9 -222.01 462.02
Cmin_load in (Cmin_load | Batch) 1 7 -222.50 459.01 0.990 2 0.6096
(1 | Batch) 0 6 -241.49 494.97 37.964 1 7.205e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
Promethion_Cabinet 1 0.0244 0.0244 1 165.109 0.0424 0.83709
Cmin_load:Sex 2 0.2097 0.2097 1 175.957 0.3669 0.54549
Cmin_load 0 0.9283 0.9283 1 176.545 1.6284 0.20360
Sex 0 3.4964 3.4964 1 9.849 6.1336 0.03307 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
Distance_traveled_norm ~ Cmin_load + Sex + (1 | Batch)
model_distance_HL.2<-(lmer(Distance_traveled_norm ~ Cmin_load*Sex + (1|Batch), Promethion_activity_HL))
shapiro.test(residuals(model_distance_HL.2))
Shapiro-Wilk normality test
data: residuals(model_distance_HL.2)
W = 0.98954, p-value = 0.2095
anova(lm(residuals(model_distance_HL.2)~fitted.values(model_distance_HL.2)))
Analysis of Variance Table
Response: residuals(model_distance_HL.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_distance_HL.2) 1 0.339 0.33916 0.6338 0.427
Residuals 178 95.258 0.53516
car::Anova(model_distance_HL.2, type ="III", test.statistic ="F")
Analysis of Deviance Table (Type III Wald F tests with Kenward-Roger df)
Response: Distance_traveled_norm
F Df Df.res Pr(>F)
(Intercept) 0.0094 1 9.812 0.92474
Cmin_load 1.3316 1 175.957 0.25009
Sex 6.0022 1 9.812 0.03469 *
Cmin_load:Sex 0.3593 1 175.957 0.54969
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
emmeans::joint_tests(model_distance_HL.2, by ="Sex")
Sex = F:
model term df1 df2 F.ratio p.value
Cmin_load 1 174.36 0.133 0.7159
Sex = M:
model term df1 df2 F.ratio p.value
Cmin_load 1 171.24 1.824 0.1787
model_distance_HL.eff<-(lmer(Distance_traveled ~ Cmin_load*Sex + (1|Batch), Promethion_activity_HL))
effects::effect("Cmin_load*Sex", model_distance_HL.eff, se =TRUE) %>% as.data.frame
model_distance_HL.resid <-(lmer(Distance_traveled_norm ~ Sex + (1|Batch), Promethion_activity_HL))
Promethion_activity_HL$Distance_traveled_resid_HL <- residuals(model_distance_HL.resid)/sigma(model_distance_HL.resid)
FigS6_distance_HL <- Promethion_activity_HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = Distance_traveled_resid_HL, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL) +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Adj. distance traveled") +
theme(axis.text.x = element_text(face = "italic")) +
facet_grid(.~Sex)
FigS6_distance_HL
FigS6_HL_legend <- cowplot::get_legend(metadata_Cmin_HL %>%
dplyr::mutate(Sex = ifelse(Sex == "F", "Female", "Male"), Cmin_load = ifelse(Cmin_load == "Low", "Low-CM", "High-CM")) %>%
dplyr::mutate(Sex_Cmin_load = paste(Sex, Cmin_load, sep = " ")) %>%
ggplot() +
geom_point(aes(x = Sex_Cmin_load, y = qPCR_Cmin_per_gCC, shape = Sex_Cmin_load, color = Sex_Cmin_load), size =3 , alpha =1,
show.legend = T) +
scale_shape_manual(values=c(16, 16,4, 4)) +
scale_color_manual(values= c(color_HL, color_HL)) +
theme_classic(base_size = 10) +
theme(legend.title = element_blank()))
FigS6_align <- cowplot::align_plots(FigS6_high_Low + theme(legend.position="none"),
FigS6_food + theme(legend.position="none"),
FigS6_feed_eff + theme(legend.position="none"),
FigS6_bomb_cal + theme(legend.position="none"),
FigS6_bb_HL + theme(legend.position="none"),
FigS6_distance_HL + theme(legend.position="none"),
align = 'v', axis = 'l')
FigS6_1 <- cowplot::plot_grid(FigS6_align[[1]],
FigS6_align[[2]],
FigS6_align[[3]],
FigS6_align[[4]],
ncol=4, nrow=1, labels = c("A", "B", "C", "D"), label_size = 12, rel_widths = c(1,1,1,1))
FigS6_2 <- cowplot::plot_grid(NA,
FigS6_align[[5]],
NA,
FigS6_align[[6]],
FigS6_HL_legend,
ncol=5, nrow=1, labels = c(NA, "E", NA, "F", NA), label_size = 12, rel_widths = c(0.3,1,0.3,1.8,0.8))
Warning: Cannot convert object of class logical into a grob.Warning: Cannot convert object of class logical into a grob.
FigureS6 <- cowplot::plot_grid(FigS6_1,
FigS6_2,
ncol=1, nrow=2, rel_heights = c(1,1))
Warning: Removed 1 rows containing missing values (geom_text).Warning: Removed 1 rows containing missing values (geom_text).Warning: Removed 1 rows containing missing values (geom_text).
FigureS6
ggsave("./FigureS6.pdf", plot = FigureS6, device = cairo_pdf,
width = 15.5,
height = 10.5,
units = "cm")
set.seed(759)
metadata_Cmin_HL_qPCR <- metadata_Cmin_HL %>%
tidyr::drop_na(Cmin_load, qPCR_16S_SQ_per_gCC) %>%
dplyr::mutate(qPCR_16S_SQ_per_gCC_norm = predict(bestNormalize(qPCR_16S_SQ_per_gCC)))
model_qPCR16S_HL<- lmerTest::lmer(qPCR_16S_SQ_per_gCC_norm ~ Cmin_load*Sex + T6_weight + Plate + (1|qPCR_Round/Batch/Sex), data = metadata_Cmin_HL_qPCR)
Warning: unable to evaluate scaled gradientWarning: Hessian is numerically singular: parameters are not uniquely determined
lmerTest::step(model_qPCR16S_HL, keep = "Cmin_load")
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -1.2e-08Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -1.2e-08Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -1.2e-08
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 11 -250.04 522.07
(1 | Sex:(Batch:qPCR_Round)) 1 10 -250.04 520.07 0.0000 1 1.0000
(1 | qPCR_Round) 2 9 -250.04 518.07 0.0000 1 1.0000
(1 | Batch:qPCR_Round) 0 8 -251.80 519.60 3.5235 1 0.0605 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
T6_weight 1 0.2349 0.2349 1 170.596 0.2863 0.5932750
Cmin_load:Sex 2 0.4815 0.4815 1 147.792 0.5894 0.4438806
Sex 3 1.0246 1.0246 1 9.734 1.2591 0.2887426
Plate 4 4.7372 2.3686 2 23.095 2.9116 0.0745347 .
Cmin_load 0 10.6378 10.6378 1 168.331 12.9777 0.0004147 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
qPCR_16S_SQ_per_gCC_norm ~ Cmin_load + (1 | Batch:qPCR_Round)
model_qPCR16S_HL.2<- lmer(qPCR_16S_SQ_per_gCC_norm ~ Cmin_load + Plate + (1 | Batch:qPCR_Round), data = metadata_Cmin_HL_qPCR)
shapiro.test(residuals(model_qPCR16S_HL.2))
Shapiro-Wilk normality test
data: residuals(model_qPCR16S_HL.2)
W = 0.9793, p-value = 0.008588
anova(lm(residuals(model_qPCR16S_HL.2) ~ fitted(model_qPCR16S_HL.2)))
Analysis of Variance Table
Response: residuals(model_qPCR16S_HL.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted(model_qPCR16S_HL.2) 1 0.689 0.68946 0.8901 0.3467
Residuals 179 138.652 0.77459
plot(model_qPCR16S_HL.2)
car::Anova(model_qPCR16S_HL.2, type = "II", test.statistic ="F")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: qPCR_16S_SQ_per_gCC_norm
F Df Df.res Pr(>F)
Cmin_load 8.4553 1 174.88 0.004112 **
Plate 2.8213 2 27.54 0.076799 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
model_qPCR16S_HL.eff<- lmer(qPCR_16S_SQ_per_gCC~ Cmin_load + Plate + (1 | Batch:qPCR_Round), data = metadata_Cmin_HL_qPCR)
Warning: Model may not have converged with 1 eigenvalue close to zero: 1.8e-17
effects::effect("Cmin_load", model_qPCR16S_HL.eff, se =TRUE) %>% as.data.frame
FigS7_mbiomass_HL <- metadata_Cmin_HL_qPCR %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
dplyr::mutate(qPCR_16S_SQ_per_gCC_e10 = qPCR_16S_SQ_per_gCC/1e10) %>%
ggplot(aes(x = Cmin_load, y = qPCR_16S_SQ_per_gCC_e10, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL, label = c("Low-CM", "High-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = expression(paste("Microbes (GE/g) x ", e^10))) +
theme(axis.text.x = element_text(face = "italic"))
FigS7_mbiomass_HL
bombcal ~ microbial biomass/cmin
options(contrasts=c("contr.sum", "contr.poly"))
set.seed(259)
metadata_Cmin_HL_qPCR_bc <- metadata_Cmin_HL_qPCR %>%
dplyr::select(MouseID, qPCR_16S_SQ_per_gCC, qPCR_Cmin_SQ_per_gCC, qPCR_Round) %>%
dplyr::left_join(metadata_bc_HL, by ="MouseID") %>%
tidyr::drop_na(bombcal_Calorific_Value_kcal_total_day) %>%
dplyr::mutate(qPCR_16S_SQ_per_gCC_norm = predict(bestNormalize(qPCR_16S_SQ_per_gCC)),
qPCR_Cmin_SQ_per_gCC_norm = predict(bestNormalize(qPCR_Cmin_SQ_per_gCC)),
bombcal_Calorific_Value_kcal_total_day_norm = predict(bestNormalize(bombcal_Calorific_Value_kcal_total_day)),
Promethion_weight_norm = predict(bestNormalize(Promethion_weight)))
model_bombcal_Cmin <- lmerTest::lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ qPCR_Cmin_SQ_per_gCC_norm*Sex + qPCR_Round + Promethion_weight_norm +(1|Batch/Sex/Promethion_Cabinet), data = metadata_Cmin_HL_qPCR_bc)
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_bombcal_Cmin)
Warning: unable to evaluate scaled gradientWarning: Model failed to converge: degenerate Hessian with 1 negative eigenvaluesWarning: Model failed to converge with 1 negative eigenvalue: -1.4e-03boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 10 -111.21 242.41
(1 | Sex:Batch) 1 9 -111.21 240.41 0.0000 1 1.00000
(1 | Batch) 2 8 -111.21 238.41 0.0000 1 1.00000
(1 | Promethion_Cabinet:(Sex:Batch)) 0 7 -114.14 242.27 5.8594 1 0.01549 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
qPCR_Cmin_SQ_per_gCC_norm:Sex 1 0.0497 0.0497 1 79.932 0.0826 0.7745795
Sex 2 0.7347 0.7347 1 22.271 1.2380 0.2777203
qPCR_Round 3 0.7736 0.7736 1 79.658 1.3059 0.2565668
qPCR_Cmin_SQ_per_gCC_norm 4 0.9449 0.9449 1 83.458 1.5865 0.2113406
Promethion_weight_norm 0 10.6658 10.6658 1 45.900 17.5674 0.0001249 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
bombcal_Calorific_Value_kcal_total_day_norm ~ Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch))
model_bombcal_biomass <- lmerTest::lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ qPCR_16S_SQ_per_gCC_norm*Sex + qPCR_Round + Promethion_weight_norm +(1|Batch/Sex/Promethion_Cabinet), data = metadata_Cmin_HL_qPCR_bc)
boundary (singular) fit: see help('isSingular')
lmerTest::step(model_bombcal_biomass)
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
Backward reduced random-effect table:
Eliminated npar logLik AIC LRT Df Pr(>Chisq)
<none> 10 -111.78 243.57
(1 | Sex:Batch) 1 9 -111.78 241.57 0.000 1 1.00000
(1 | Batch) 2 8 -111.78 239.57 0.000 1 1.00000
(1 | Promethion_Cabinet:(Sex:Batch)) 0 7 -114.52 243.04 5.471 1 0.01933 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward reduced fixed-effect table:
Degrees of freedom method: Satterthwaite
Eliminated Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
qPCR_16S_SQ_per_gCC_norm:Sex 1 0.2379 0.2379 1 76.549 0.3863 0.5360894
qPCR_16S_SQ_per_gCC_norm 2 0.0188 0.0188 1 77.540 0.0308 0.8612200
Sex 3 0.8487 0.8487 1 24.232 1.4087 0.2467763
qPCR_Round 4 0.8994 0.8994 1 81.231 1.4937 0.2251849
Promethion_weight_norm 0 10.6658 10.6658 1 45.900 17.5674 0.0001249 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Model found:
bombcal_Calorific_Value_kcal_total_day_norm ~ Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch))
model_bombcal_Cmin.2 <- lmerTest::lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ qPCR_Cmin_SQ_per_gCC_norm + Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_Cmin_HL_qPCR_bc)
model_bombcal_biomass.2 <- lmerTest::lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ qPCR_16S_SQ_per_gCC_norm + Promethion_weight_norm + (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_Cmin_HL_qPCR_bc)
shapiro.test(residuals(model_bombcal_Cmin.2))
Shapiro-Wilk normality test
data: residuals(model_bombcal_Cmin.2)
W = 0.99156, p-value = 0.8481
shapiro.test(residuals(model_bombcal_biomass.2))
Shapiro-Wilk normality test
data: residuals(model_bombcal_biomass.2)
W = 0.99057, p-value = 0.7836
anova(lm(residuals(model_bombcal_Cmin.2)~fitted.values(model_bombcal_Cmin.2)))
Analysis of Variance Table
Response: residuals(model_bombcal_Cmin.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_bombcal_Cmin.2) 1 0.575 0.57455 1.0795 0.3017
Residuals 86 45.772 0.53223
anova(lm(residuals(model_bombcal_biomass.2)~fitted.values(model_bombcal_biomass.2)))
Analysis of Variance Table
Response: residuals(model_bombcal_biomass.2)
Df Sum Sq Mean Sq F value Pr(>F)
fitted.values(model_bombcal_biomass.2) 1 0.574 0.57358 1.0376 0.3112
Residuals 86 47.539 0.55278
car::Anova(model_bombcal_Cmin.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: bombcal_Calorific_Value_kcal_total_day_norm
F Df Df.res Pr(>F)
qPCR_Cmin_SQ_per_gCC_norm 1.5364 1 83.437 0.2186307
Promethion_weight_norm 14.2885 1 49.656 0.0004214 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
car::Anova(model_bombcal_biomass.2, test.statistic ="F", type ="II")
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
Response: bombcal_Calorific_Value_kcal_total_day_norm
F Df Df.res Pr(>F)
qPCR_16S_SQ_per_gCC_norm 0.012 1 78.927 0.9131847
Promethion_weight_norm 15.259 1 49.522 0.0002844 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
r2_model_bombcal_Cmin_mar<- partR2(model_bombcal_Cmin.2, partvars = c("qPCR_Cmin_SQ_per_gCC_norm"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_bombcal_Cmin_mar$R2 %>% dplyr::filter(term == "qPCR_Cmin_SQ_per_gCC_norm") %>% dplyr::select(estimate) %>% pull()
[1] 0.01108785
r2_model_bombcal_biomass_mar<- partR2(model_bombcal_biomass.2, partvars = c("qPCR_16S_SQ_per_gCC_norm"),
R2_type = "marginal", nboot = 10)
| | 0 % ~calculating
|+++++ | 10% ~01s
|++++++++++ | 20% ~01s
|+++++++++++++++ | 30% ~01s
|++++++++++++++++++++ | 40% ~01s
|+++++++++++++++++++++++++ | 50% ~01s
|++++++++++++++++++++++++++++++ | 60% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~00s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
r2_model_bombcal_biomass_mar$R2 %>% dplyr::filter(term == "qPCR_16S_SQ_per_gCC_norm") %>% dplyr::select(estimate) %>% pull()
[1] 7.367549e-05
model_bombcal_HL_resid <- lmer(bombcal_Calorific_Value_kcal_total_day_norm ~ Sex + Promethion_weight_norm+ (1 | Promethion_Cabinet:(Sex:Batch)), data = metadata_Cmin_HL_qPCR_bc)
metadata_Cmin_HL_qPCR_bc$bombcal_Calorific_Value_kcal_total_day_resid <- residuals(model_bombcal_HL_resid)/sigma(model_bombcal_HL_resid)
FigS7_biomass_bc<- metadata_Cmin_HL_qPCR_bc %>%
ggplot(aes(x= qPCR_16S_SQ_per_gCC_norm ,y=bombcal_Calorific_Value_kcal_total_day_resid)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color ="black")+
geom_point(aes(color = Cmin_load, shape = Sex), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_HL, label = c(expression(italic("Low-CM")), expression(italic("High-CM"))), name = "Group") +
theme_classic(base_size = 10) +
labs(x = "Norm. microbes", y = "Adj. fecal energy\ncontent")
FigS7_biomass_bc
FigS7_cmin_bc<- metadata_Cmin_HL_qPCR_bc %>%
ggplot(aes(x= qPCR_Cmin_SQ_per_gCC_norm ,y=bombcal_Calorific_Value_kcal_total_day_resid)) +
geom_smooth(method = "lm", se = F, alpha = 0.8, size = 0.5, color ="black")+
geom_point(aes(color = Cmin_load, shape = Sex), alpha =0.7, size =0.75, show.legend = T) +
scale_shape_manual(values=shape_Sex, label = c("Female", "Male"),name = "Sex") +
scale_color_manual(values=color_HL, label = c(expression(italic("Low-CM")), expression(italic("High-CM"))), name = "Group") +
theme_classic(base_size = 10) +
labs(x = "Norm. C. minuta", y = "Adj. fecal energy\ncontent")
FigS7_cmin_bc
alpha hL
Alpha_div_HL <- metadata_Cmin_HL %>%
dplyr::select(MouseID, Cmin_load) %>%
dplyr::left_join(Alpha_div, by ="MouseID") %>%
tidyr::drop_na(Cmin_load, shannon_entropy)
Alpha_div_HL_M <- Alpha_div_HL %>%
filter(Sex =="M")
Alpha_div_HL_F <- Alpha_div_HL %>%
filter(Sex =="F")
wilcox.test(shannon_entropy~Cmin_load, data = Alpha_div_HL_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: shannon_entropy by Cmin_load
W = 1072, p-value = 0.501
alternative hypothesis: true location shift is not equal to 0
wilcox.test(shannon_entropy~Cmin_load, data = Alpha_div_HL_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: shannon_entropy by Cmin_load
W = 1036, p-value = 0.8636
alternative hypothesis: true location shift is not equal to 0
wilcox.test(pielou_evenness~Cmin_load, data = Alpha_div_HL_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: pielou_evenness by Cmin_load
W = 898, p-value = 0.4503
alternative hypothesis: true location shift is not equal to 0
wilcox.test(pielou_evenness~Cmin_load, data = Alpha_div_HL_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: pielou_evenness by Cmin_load
W = 820, p-value = 0.06309
alternative hypothesis: true location shift is not equal to 0
wilcox.test(faith_pd~Cmin_load, data = Alpha_div_HL_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: faith_pd by Cmin_load
W = 1322, p-value = 0.006441
alternative hypothesis: true location shift is not equal to 0
wilcox.test(faith_pd~Cmin_load, data = Alpha_div_HL_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: faith_pd by Cmin_load
W = 1424, p-value = 0.004262
alternative hypothesis: true location shift is not equal to 0
wilcox.test(observed_features~Cmin_load, data = Alpha_div_HL_M, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: observed_features by Cmin_load
W = 1330, p-value = 0.005269
alternative hypothesis: true location shift is not equal to 0
wilcox.test(observed_features~Cmin_load, data = Alpha_div_HL_F, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: observed_features by Cmin_load
W = 1393, p-value = 0.008895
alternative hypothesis: true location shift is not equal to 0
–> sex-dimorphic effects gone! –> analyses by group not separated by sex anymore!
wilcox.test(shannon_entropy~Cmin_load, data = Alpha_div_HL, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: shannon_entropy by Cmin_load
W = 4309, p-value = 0.5437
alternative hypothesis: true location shift is not equal to 0
wilcox.test(pielou_evenness~Cmin_load, data = Alpha_div_HL, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: pielou_evenness by Cmin_load
W = 3531, p-value = 0.1095
alternative hypothesis: true location shift is not equal to 0
wilcox.test(faith_pd~Cmin_load, data = Alpha_div_HL, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: faith_pd by Cmin_load
W = 5457, p-value = 0.0001113
alternative hypothesis: true location shift is not equal to 0
wilcox.test(observed_features~Cmin_load, data = Alpha_div_HL, exact = FALSE, correct = FALSE, conf.int = FALSE)
Wilcoxon rank sum test
data: observed_features by Cmin_load
W = 5433.5, p-value = 0.000146
alternative hypothesis: true location shift is not equal to 0
mean_se_HL <- Alpha_div_HL %>%
dplyr::group_by(Cmin_load) %>%
dplyr::summarise(mean = mean(shannon_entropy), se = standard_error(shannon_entropy))%>%
dplyr::mutate(alpha = "se")
mean_pe_HL <- Alpha_div_HL %>%
dplyr::group_by(Cmin_load) %>%
dplyr::summarise(mean = mean(pielou_evenness), se = standard_error(pielou_evenness))%>%
dplyr::mutate(alpha = "pe")
mean_fdp_HL <- Alpha_div_HL %>%
dplyr::group_by(Cmin_load) %>%
dplyr::summarise(mean = mean(faith_pd), se = standard_error(faith_pd))%>%
dplyr::mutate(alpha = "fdp")
mean_of_HL <- Alpha_div_HL %>%
dplyr::group_by(Cmin_load) %>%
dplyr::summarise(mean = mean(observed_features), se = standard_error(observed_features))%>%
dplyr::mutate(alpha = "of")
rbind(mean_se_HL, mean_pe_HL, mean_fdp_HL, mean_of_HL)
FigS7_alpha_HL_MR <- Alpha_div_HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = observed_features, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "# microbial species") +
theme(axis.text.x = element_text(face = "italic"))
FigS7_alpha_HL_MR
FigS7_alpha_HL_SE <- Alpha_div_HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = shannon_entropy, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Shannon Entropy")+
theme(axis.text.x = element_text(face = "italic"))
FigS7_alpha_HL_SE
FigS7_alpha_HL_FPD <- Alpha_div_HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = faith_pd, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Faith's PD")+
theme(axis.text.x = element_text(face = "italic"))
FigS7_alpha_HL_FPD
FigS7_alpha_HL_PE <- Alpha_div_HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = pielou_evenness, shape = Sex, color = Cmin_load)) +
geom_quasirandom(alpha = 0.7, size = 0.75) +
stat_summary(fun = mean, geom = "point", size=2, aes(group = Cmin_load), color = "black", alpha = 0.6, shape = 15) +
scale_color_manual(values = color_HL, label = c("Killed-CM", "Live-CM"), name = "Treatment") +
scale_shape_manual(values = shape_Sex, label = c("Female", "Male")) +
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
theme_classic(base_size = 10) +
theme(axis.title.x=element_blank(), plot.title = element_text(hjust = 0.5)) +
labs(y = "Pilou evenness")+
theme(axis.text.x = element_text(face = "italic"))
FigS7_alpha_HL_PE
beta diversity
reads_rare_norm_metadata <- reads_rare_norm_metadata[ order(row.names(reads_rare_norm_metadata)), ]
metadata_Cmin_load <- metadata_Cmin_HL %>%
dplyr::select(MouseID, Cmin_load)
reads_rare_norm_metadata.melt_HL <- reads_rare_norm_metadata %>%
tibble::rownames_to_column(var = "sampleid") %>%
dplyr::left_join(metadata_Cmin_load, by ="MouseID") %>%
dplyr::select(sampleid, Sex, Cmin_load) %>%
dplyr::mutate_if(is.factor,as.character)
wUF_melt_HL <- melt(as.matrix(Beta_wUF.2)) %>%
filter(as.character(Var1) != as.character(Var2)) %>%
mutate_if(is.factor,as.character)
uwUF_melt_HL <- melt(as.matrix(Beta_uwUF.2)) %>%
filter(as.character(Var1) != as.character(Var2)) %>%
mutate_if(is.factor,as.character)
colnames(reads_rare_norm_metadata.melt_HL) = c("Var1", "Sex1", "Cmin_load1")
wUF_melt_HL = left_join(wUF_melt_HL, reads_rare_norm_metadata.melt_HL, by = "Var1")
uwUF_melt_HL = left_join(uwUF_melt_HL, reads_rare_norm_metadata.melt_HL, by = "Var1")
colnames(reads_rare_norm_metadata.melt_HL) = c("Var2", "Sex2", "Cmin_load2")
wUF_melt_HL = left_join(wUF_melt_HL, reads_rare_norm_metadata.melt_HL, by = "Var2")
uwUF_melt_HL = left_join(uwUF_melt_HL, reads_rare_norm_metadata.melt_HL, by = "Var2")
set.seed(765)
wUF_melt.HL <- wUF_melt_HL %>%
dplyr::filter(Cmin_load1 == Cmin_load2, Sex1 == Sex2) %>%
dplyr::mutate(Cmin_load = Cmin_load1, Sex = Sex1)
wilcox.test(value ~ Cmin_load, data = wUF_melt.HL, exact = FALSE, correct = FALSE)
Wilcoxon rank sum test
data: value by Cmin_load
W = 6273800, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
uwUF_melt.HL <- uwUF_melt_HL %>%
dplyr::filter(Cmin_load1 == Cmin_load2, Sex1 == Sex2) %>%
dplyr::mutate(Cmin_load = Cmin_load1, Sex = Sex1)
wilcox.test(value ~ Cmin_load, data = uwUF_melt.HL, exact = FALSE, correct = FALSE)
Wilcoxon rank sum test
data: value by Cmin_load
W = 6352464, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
FigS7_wUF <- wUF_melt.HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = value, fill=factor(Cmin_load))) +
theme_classic(base_size = 10) +
geom_boxplot(alpha =0.7, outlier.size = 0.3, outlier.alpha = 0.5) +
scale_fill_manual(values=color_HL)+
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
labs(y = "weighted\nUniFrac distances") +
theme(axis.text.x = element_text(face = "italic"), axis.title.x=element_blank())
FigS7_wUF
FigS7_uwUF <-uwUF_melt.HL %>%
drop_na(Cmin_load) %>%
dplyr::mutate(Cmin_load = factor(Cmin_load, levels= c("Low", "High"))) %>%
ggplot(aes(x = Cmin_load, y = value, fill=factor(Cmin_load))) +
theme_classic(base_size = 10) +
geom_boxplot(alpha =0.7, outlier.size = 0.3, outlier.alpha = 0.5) +
scale_fill_manual(values=color_HL)+
scale_x_discrete(labels=c("Low" = "Low\nCM", "High" = "High\nCM")) +
labs(y = "unweighted\nUniFrac distances") +
theme(axis.text.x = element_text(face = "italic"), axis.title.x=element_blank())
FigS7_uwUF
FigS7_HL_legend <- cowplot::get_legend(metadata_Cmin_HL %>%
dplyr::mutate(Sex = ifelse(Sex == "F", "Female", "Male"), Cmin_load = ifelse(Cmin_load == "Low", "Low-CM", "High-CM")) %>%
dplyr::mutate(Sex_Cmin_load = paste(Sex, Cmin_load, sep = " ")) %>%
ggplot() +
geom_point(aes(x = Sex_Cmin_load, y = qPCR_Cmin_per_gCC, shape = Sex_Cmin_load, color = Sex_Cmin_load), size =3 , alpha =1,
show.legend = T) +
scale_shape_manual(values=c(16, 16,4, 4)) +
scale_color_manual(values= c(color_HL, color_HL)) +
theme_classic(base_size = 10) +
theme(legend.title = element_blank()) +
theme(legend.position = "bottom"))
FigS7_align <- cowplot::align_plots(FigS7_mbiomass_HL + theme(legend.position="none"),
FigS7_biomass_bc + theme(legend.position="none"),
FigS7_cmin_bc + theme(legend.position="none"),
FigS7_alpha_HL_MR + theme(legend.position="none"),
FigS7_alpha_HL_SE + theme(legend.position="none"),
FigS7_alpha_HL_FPD + theme(legend.position="none"),
FigS7_alpha_HL_PE + theme(legend.position="none"),
FigS7_wUF + theme(legend.position="none"),
FigS7_uwUF + theme(legend.position="none"),
align = 'hv', axis = 'tblr')
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
FigS7_1 <- cowplot::plot_grid(FigS7_align[[1]],
FigS7_align[[2]],
FigS7_align[[3]],
FigS7_align[[4]],
FigS7_align[[6]],
FigS7_align[[5]],
FigS7_align[[7]],
FigS7_align[[8]],
FigS7_align[[9]],
ncol=3, nrow=3, labels = c("A", "B", "C", "D", "E", "F", "G", "H", "I"), label_size = 12, rel_widths = c(1,1, 1))
FigureS7 <- cowplot::plot_grid(FigS7_1,
FigS7_HL_legend,
ncol=1, nrow=2, rel_heights = c(3, 0.05))
FigureS7
ggsave("./FigureS7.pdf", plot = FigureS7, device = cairo_pdf,
width = 16.5,
height = 14,
units = "cm")
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS
Matrix products: default
BLAS: /opt/R/4.0.2/lib/R/lib/libRblas.so
LAPACK: /opt/R/4.0.2/lib/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggbeeswarm_0.6.0 ggh4x_0.2.2 cowplot_1.1.1 rsq_2.5 partR2_0.9.1.9000
[6] mapdata_2.3.1 maps_3.4.1 ggmap_3.0.1 patchwork_1.1.2 vegan_2.5-7
[11] permute_0.9-7 effects_4.2-1 Maaslin2_1.7.3 emmeans_1.7.2 reshape2_1.4.4
[16] lmerTest_3.1-3 lme4_1.1-28 Matrix_1.2-18 PerformanceAnalytics_2.0.4 xts_0.12.1
[21] zoo_1.8-9 bestNormalize_1.8.2 Rmisc_1.5 plyr_1.8.6 lattice_0.20-41
[26] car_3.0-12 carData_3.0-5 lubridate_1.8.0 ggpubr_0.4.0 ggforce_0.3.3
[31] scales_1.2.1 ggthemes_4.2.4 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.8
[36] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.6 ggplot2_3.3.5
[41] tidyverse_1.3.1 data.table_1.14.2 switchr_0.14.5
loaded via a namespace (and not attached):
[1] readxl_1.3.1 backports_1.4.1 sp_1.4-6 splines_4.0.2 listenv_0.8.0 usethis_2.1.5
[7] lpsymphony_1.18.0 digest_0.6.29 butcher_0.1.5 foreach_1.5.2 fansi_1.0.2 magrittr_2.0.2
[13] cluster_2.1.0 doParallel_1.0.17 tzdb_0.2.0 remotes_2.4.2 recipes_0.2.0 globals_0.14.0
[19] modelr_0.1.8 gower_1.0.0 hardhat_0.2.0 jpeg_0.1-10 colorspace_2.0-3 rvest_1.0.2
[25] mitools_2.4 haven_2.4.3 xfun_0.29 crayon_1.5.0 RCurl_1.98-1.7 jsonlite_1.8.0
[31] biglm_0.9-2.1 survival_3.1-12 iterators_1.0.14 glue_1.6.1 polyclip_1.10-0 gtable_0.3.0
[37] ipred_0.9-12 future.apply_1.8.1 DEoptimR_1.0-10 abind_1.4-5 mvtnorm_1.1-3 DBI_1.1.2
[43] rngtools_1.5.2 rstatix_0.7.0 Rcpp_1.0.8 xtable_1.8-4 lava_1.6.10 survey_4.1-1
[49] prodlim_2019.11.13 getopt_1.20.3 httr_1.4.2 ellipsis_0.3.2 pkgconfig_2.0.3 farver_2.1.0
[55] nnet_7.3-14 dbplyr_2.1.1 utf8_1.2.2 RJSONIO_1.3-1.6 labeling_0.4.2 tidyselect_1.1.2
[61] rlang_1.0.1 munsell_0.5.0 cellranger_1.1.0 tools_4.0.2 cli_3.2.0 generics_0.1.2
[67] broom_0.7.12 knitr_1.37 fs_1.5.2 robustbase_0.93-9 RgoogleMaps_1.4.5.3 pbapply_1.5-0
[73] future_1.24.0 nlme_3.1-148 doRNG_1.8.2 xml2_1.3.3 pbkrtest_0.5.1 compiler_4.0.2
[79] rstudioapi_0.13 beeswarm_0.4.0 png_0.1-7 ggsignif_0.6.3 reprex_2.0.1 tweenr_1.0.2
[85] pcaPP_1.9-74 stringi_1.7.6 nloptr_1.2.2.3 vctrs_0.3.8 pillar_1.7.0 lifecycle_1.0.1
[91] optparse_1.7.1 estimability_1.3 bitops_1.0-7 insight_0.17.1 R6_2.5.1 vipor_0.4.5
[97] parallelly_1.30.0 codetools_0.2-16 boot_1.3-25 MASS_7.3-51.6 assertthat_0.2.1 nortest_1.0-4
[103] withr_2.5.0 Deriv_4.1.3 mgcv_1.8-31 parallel_4.0.2 hms_1.1.1 quadprog_1.5-8
[109] grid_4.0.2 rpart_4.1-15 timeDate_3043.102 coda_0.19-4 class_7.3-17 minqa_1.2.4
[115] numDeriv_2016.8-1.1